473,400 Members | 2,163 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,400 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 1127
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.