Create dll for EventViewer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I perform: EventLog.WriteEntry(strSource, strEntry,
EventLogEntryType.Error, intEventID)

The event viewer reports

The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile ) cannot
be found. The local computer may not have the necessary registry information
or message DLL files to display messages from a remote computer.

I think I need to create a dll that returns error messages for event ID’s.
Can this dll be written in VB.NET?
Any pointers to documentation that tells me how to go about creating this dll?

Or am I missing something and have got it totally wrong?

Thanks in advance.
Chris.
 
you need to see if the source exists and create it if it doesn't...then
write to it:

public shared sub LogEvent(byval Source as string, byval Message as string,
byval Type as eventlogentrytype)
dim eventLog as new system.diagnostics.eventlog
try
if not eventLog.SourceExists(Source) then
eventLog.CreateEventSource(Source, "Log Name Here")
eventLog.Log = "Log Name Here"
eventLog.WriteEntry(Source, Message, Type)
catch ex as Exception
throw new ApplicationException(ex.message, ex.innerexception)
end try
end sub

hth,

steve


| When I perform: EventLog.WriteEntry(strSource, strEntry,
| EventLogEntryType.Error, intEventID)
|
| The event viewer reports
|
| The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile )
cannot
| be found. The local computer may not have the necessary registry
information
| or message DLL files to display messages from a remote computer.
|
| I think I need to create a dll that returns error messages for event ID's.
| Can this dll be written in VB.NET?
| Any pointers to documentation that tells me how to go about creating this
dll?
|
| Or am I missing something and have got it totally wrong?
|
| Thanks in advance.
| Chris.
 
I know about checking if the source exists. It does and that's how I actually
manage to get enties in the event log. What I want to do is stop the "The
description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile ) cannot be
found" message for my entries in the event viewer.
 
Chris,
Do you delete the event source? You shouldn't!

When you use CreateEventSource, entries are made in the registry that
associations the event source with
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll (for
VS.NET 2003 .NET 1.1) This dll handles all event log messages. It has a
generic message that is able to display the message that your app sends.

If you delete the event source these entries are removed, and you see you
error.

I'll see if I can find a link that explains the above...

Hope this helps
Jay
 
Jay,

Thanks for all you help. The link was very useful.
I hadn't actually used CreateEventSource as it's a web service that's
creating events and it doesn't have permission to create the source so this
was a manual task. For now all I done is update our documentation to say that
the EventMessageFile string value needs creating and populating. This has
stopped the annoying "The description for Event ID (???) in Source (xxx)
cannot be found".

Thanks.
Chris.
 
Chris,
I hope you didn't say to update the registry directly!

As the EventLogInstaller class is designed to update the registry, in all
the correct places, with all the correct values...

What I normally do is create an ProjectInstaller class in my project, that
includes an EventLogInstaller object. When I deploy the web service I use
installutil.exe (on the server) to allow any installer classes in the
assembly to be ran. This way there is not a lot of manual fiddling if the
project ever needs to be deployed on a backup server.

Alternatively with the ProjectInstaller you can create a setup project to
deploy the web service...

Hope this helps
Jay
 
It was done directly. The web service is currently installed on one of our
test IIS servers. I haven't got round to creating the deployment bits due to
pressure from above for our support team to be able to access the web service
so they can test it's functionality is correct.

Chris.
 
Chris,
I understand, my point is if you create the installer now & get use to using
the installer you wont have 15 to 20 notes later on things you need to
remember to change when you deploy to test, qa, production, recovery or any
place else. All the little things you need to change will be nice & neatly
packaged in your project installer, which is neatly contained within your
Web Services main assembly.

For details on Creating Installation Components see:

http://msdn.microsoft.com/library/d...us/vbcon/html/vboriInstallationComponents.asp

Hope this helps
Jay
 
Jay,

Thanks for the reply. We have a development meeting today so I push that
this is done sooner rather than later.

Chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top