What API can i use to log to windows event logger

Aug 19, 2011 at 7:51 AM


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.

Aug 19, 2011 at 12:26 PM


Aug 22, 2011 at 8:57 AM


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."



Aug 23, 2011 at 5:29 PM

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