473,768 Members | 3,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

EventLog.WriteE ntry(source, message) does not write to source

I have the following code in a class...

---------------------------------------------------------------------------------
....
Private _eL As EventLog = Nothing
Private _eLName As String = My.Settings.Eve ntLogName
Private _sourceName As String

Private Sub New()
' Require user passes source name.
End Sub
Public Sub New(ByVal EventSourceName As String)
_eL = New EventLog(_eLNam e, My.Computer.Nam e, EventSourceName )

' This will ensure that the event source is registered w/ the EMSL
event log.
If EventLog.LogNam eFromSourceName (EventSourceNam e,
My.Computer.Nam e).Trim.Length 0 _
And EventLog.LogNam eFromSourceName (EventSourceNam e, My.Computer.Nam e)
<_eL.Log Then
EventLog.Delete EventSource(Eve ntSourceName, My.Computer.Nam e)
End If

_eL.CreateEvent Source(EventSou rceName, _eL.Log, My.Computer.Nam e)
_sourceName = EventSourceName
End Sub
....
Public Sub WriteEvent(ByVa l Message As String, ByVal EventType As
EventLogEntryTy pe, Optional ByVal ID As Integer = 68)
EventLog.WriteE ntry(_sourceNam e, Message, EventType, ID)
End Sub

....
---------------------------------------------------------------------------------

The eventlog gets created, but the events are always written to the
Application eventlog.

Please, help.

Thanks,
Jacob

Sep 9 '08 #1
1 3557
Never mind...
The source had an illegal character.
thanks anyway.
Sep 9 '08 #2

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

Similar topics

0
1105
by: Erick | last post by:
Hi, Does any one know how to avoid to register of the event log source by the TransactedInstaller object? I have a service which have some code into the main method to self-register base on the paramenter. Im using the TransactedInstaller class to do this. In order to know the output from the installation I call the installation as this to get a log of the installation.
1
7289
by: john s | last post by:
I am trying to create a message text file for the Catagory field in order to map the catagory input number to a string text. I have found some MSDN information on this, but it appears to only be for C/C++. What I have found in MSDN so far can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/message_files.asp and...
2
3546
by: Next | last post by:
Hello all, I have a windows service that was suppose to write some events into its own EventLog. I created the EventLog using the component on VS 2003 toolbar Added an installer for it. Set all the appropriate properties to assign the new Source to a new log. For some reason installutil.exe created the source in the correct log. But
3
15635
by: John Lee | last post by:
Hi, we have been trying so many days and could not figure it out - please help!!! in windows 2003, we created an application pool and assigned a domain account as its identity - we also assigned this domain account to IIS_WPG group, and also assigned this domain account all priviledges that NETWORK SERVICE has in local security policy mmc ... but when we try to use System.Diagnosis.EventLog.WriteEntry("source", "test") we got access...
1
1671
by: MAL | last post by:
Hello, I am writing a service program that writes to a custom EventLog. I would like the two classes used in the service to write messages to the same log ideally using a different Source name for filtering etc. So far I am having little luck. I feel that I have been through the documentation extensively but am chasing my tail. It seems like it should be as simple as .CreateEventSource in each class I want to write to the custom log,...
0
376
by: Karthik Srinivasan | last post by:
Hi, My web application which runs on Windows 2003 server writes to EventLog during application startup but I get the following exception Requested registry access is not allowed. at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex)
1
15988
by: martin | last post by:
Hi, I'm having some problems with the System.Diagnostics.EventLog class in .NET 2.0 I need to recreate an event message source inside a new log but the messages keeps ending up in the old log?! I have simplified my code into this tiny snippet: EventLog.CreateEventSource("mySrc", "myLog1");
0
1818
by: rene | last post by:
I'm trying to use costome categories in my eventlog for a program I'm writing. But I have some problems with it, I cant get it to work. Checklist for how I did this. 1. Created a resourceful.mc content is like this. MessageId=0x1 Severity=Success SymbolicName=INSTALL_CATEGORY
0
1017
by: pbh | last post by:
Hi all I've written a Service application and it must use it's own EventLog. The Service is checking if it is registered as EventLog source, and if not it creates it's own EventLog. Unfortunately the .NET installer program is registering my service as an standard Application EventLog source - making it impossible for my Service to have it's own EventLog (unless I delete the installer created EventLog registry entry after the installation of...
0
9576
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9961
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9843
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8840
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5283
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.