What API can i use to log to windows event logger

Aug 19, 2011 at 6:51 AM

Hi,

I am new to log4jna and want to use it to log events to windows event logger. Can someone share some sample code that will give some idea of how to use it (which API to use for logging) etc.

Coordinator
Aug 19, 2011 at 11:26 AM

http://log4jna.codeplex.com/wikipage?title=org.apache.log4jna.nt.Win32EventLogAppender

Aug 22, 2011 at 7:57 AM

Hi,

Thanks for the quick response. I am now able to create events. There are getting logged under Event Viewer -> Symantec Endpoint Protection Manager.

This is because I want a custom target log which is 'Symantec Endpoint Protection Manager' rather than logging under Application.

For this to work, I have created following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\ Symantec Endpoint Protection Manager\

and have mapped following values in it:

CategoryMessageFile: points to Win32EventLogAppender.dll

EventMessageFile: points to Win32EventLogAppender.dll

CategoryCount: 6

TypesSupported: 7

However, the events that get logged still show following error message. Can you please advise what's going wrong here? Also, can you please let me know how to provide a specific event id for a event through the code?

 "The description for Event ID ( 4096 ) in Source ( Symantec Endpoint Protection Manager ) cannot be found."

 

 

Coordinator
Aug 23, 2011 at 4:29 PM

The path of the HKLM key should be eventlog\Application\Symatec...\, you're missing Application, I think.