473,391 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,391 software developers and data experts.

Creating a custom log

UJ
I am trying to have a service write out to a custom log in the event log.
I'm using the following code:
Dim lsEventSource As String = "test1234"
Dim lsEventLog As String = "CustomLog"

If (Not EventLog.SourceExists(lsEventSource)) Then
EventLog.DeleteEventSource(lsEventSource)
EventLog.CreateEventSource(lsEventSource, lsEventLog)
End If

Dim llogEventLog As EventLog
llogEventLog = New EventLog
llogEventLog.Source = lsEventSource

llogEventLog.WriteEntry("This is a test spot for the event log.")
Can anybody tell me what's wrong with the code? No matter what I put for the
lsEventLog name, it always is being written to the Application log. I've
also tried changing the name of the EventSource to something else just to
see what happens then.....

Nov 21 '05 #1
1 1126
April 15, 2005

The problem is when you create the new event log llogeventlog, you are
not specifying the name of the log...
Dim lsEventSource As String = "test1234"
Dim lsEventLog As String = "CustomLog"

If (Not EventLog.SourceExists(lsEventSource)) Then
EventLog.DeleteEventSource(lsEventSource)
EventLog.CreateEventSource(lsEventSource, lsEventLog)
End If

Dim llogEventLog As EventLog
llogEventLog = New EventLog
llogEventLog.Source = lsEventSource
llogEventLog.Log = lsEventLog ' Add custom log name
llogEventLog.WriteEntry("This is a test spot for the event log.")

This will specify the custom log as the one to write to. Have a great day!

Joseph Bittman MCAD
Microsoft Certified Application Developer
"UJ" <UJ@nowhere.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
I am trying to have a service write out to a custom log in the event log.
I'm using the following code:
Dim lsEventSource As String = "test1234"
Dim lsEventLog As String = "CustomLog"

If (Not EventLog.SourceExists(lsEventSource)) Then
EventLog.DeleteEventSource(lsEventSource)
EventLog.CreateEventSource(lsEventSource, lsEventLog)
End If

Dim llogEventLog As EventLog
llogEventLog = New EventLog
llogEventLog.Source = lsEventSource

llogEventLog.WriteEntry("This is a test spot for the event log.")
Can anybody tell me what's wrong with the code? No matter what I put for
the lsEventLog name, it always is being written to the Application log.
I've also tried changing the name of the EventSource to something else
just to see what happens then.....

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: T | last post by:
I have a web site i want to deploy using a VS.NEt set up project. I have no problems with that, that is fine and works no problem. But the web application uses a custom event log to log...
0
by: Jai | last post by:
Dear All Creating Custom Controls but Not User Controls,How to create custom controls,i.e Extending the functionality of the Existing Controls.(Web Custom Controls). Previously i have...
0
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works...
0
by: Julien | last post by:
Hi ! I'm creating a custom control, in which I would render an image with client-side script code to display/hide a calendar control which also belong to my custom control. In this control I've...
3
by: clsmith66 | last post by:
I hope this is just something stupid I'm missing and someone can easily point out my error. I'm trying to do a few turorials on windows services, and the couple I found so far just create an event...
17
by: Lee Harr | last post by:
I understand how to create a property like this: class RC(object): def _set_pwm(self, v): self._pwm01 = v % 256 def _get_pwm(self): return self._pwm01 pwm01 = property(_get_pwm, _set_pwm)
1
by: Abdo Haji-Ali | last post by:
Previously I used to create user controls if I wanted to use a specific set of controls in multiple pages, however I want to deploy my control in other applications so I thought of creating custom...
3
by: =?Utf-8?B?R2hpc3Rvcw==?= | last post by:
Hi all, We have a N-Tier framework and we now create a Web Site App to wotk with this architecture. I add reference from my libraries in the project and creating page and controls is very...
1
by: =?Utf-8?B?QXJ0aHVyIFBhcmtlcg==?= | last post by:
I have been looking for information on creating new custom calendars; not the control, but the class that manages dates and date calculations. The only thing I've been able to find in any of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.