You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jay Riddell <jr...@doradosoftware.com> on 2001/07/19 22:42:41 UTC
NT Event Log Appender
I have been failing in attempting to customize the "SOURCE"
identifier in the NT Event Log (via usage of the NT Event Log appender).
Debugging the source file NTEventLogAppender.java shows that
the "base constructor" calls the native routine registerEventSource routine
with the string "Log4j". Also, it appears that configuring the property
(in my case, via an XML config file) occurs some time after the constructor
has been called.
Therefore, the property seems to be settable only after it is used !
The following diff *MAY* fix this. What the code change attempts to do is
to call this registerEventSource method the *first* time that an NT
Event is generated. However, since I do not have the capability
to rebuild the .DLL file, I cannot be certain it would work.
I would be happy to provide testing support if someone else could provide
compilation support <hint, hint, hint> . . .
Thanks
DIFF:
47d46
< private boolean haveRegistered = false ;
84a84,89
> try {
> _handle = registerEventSource(server, source);
> } catch (Exception e) {
> e.printStackTrace();
> _handle = 0;
> }
134,145d138
<
< if ( haveRegistered == false )
< {
< haveRegistered = true ;
<
< try {
< _handle = registerEventSource(server, source);
< } catch (Exception e) {
< e.printStackTrace();
< _handle = 0;
< }
< }
----------------------------------------------------------------
Jay Riddell
Dorado Software
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org