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 Ricardo Cardoso <rf...@gmail.com> on 2012/07/13 15:34:06 UTC
org.apache.log4j.nt.NTEventLogAppender.registerEventSource
Hi my name is Ricardo and I am trying to learn how to use log4j.
I am now trying to learn how to use NTEventLogAppender but without success.
I already put the NTEventLogAppender.dll in windows/system32 folder but
when I run the example code of this dll I get this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.apache.log4j.nt.NTEventLogAppender.registerEventSource(Ljava/lang/St
ring;Ljava/lang/String;)I
at
org.apache.log4j.nt.NTEventLogAppender.registerEventSource(Native
Method)
at
org.apache.log4j.nt.NTEventLogAppender.<init>(NTEventLogAppender.java:79
)
at
org.apache.log4j.nt.NTEventLogAppender.<init>(NTEventLogAppender.java:53
)
at com.log.eventlog.Teste.main(Teste.java:15)
My java code is the following:
BasicConfigurator.configure(new
NTEventLogAppender("ola"));
Logger logger =3D
Logger.getLogger("org.apache.log4j.nt.NTEventLogAppenderTest");
int i =3D 0;
logger.debug( "Message " + i++);
logger.info( "Message " + i++);
logger.warn( "Message " + i++);
logger.error( "Message " + i++);
logger.log(Level.FATAL, "Message " + i++);
logger.debug("Message " + i++, new Exception("Just
testing."));
I know that this can be a silly error but in the internet I only get pages
that show me the NTEventLogAppender class.
Can anyone help me?
Best Regards
AW: org.apache.log4j.nt.NTEventLogAppender.registerEventSource
Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Ricardo,
that is what the sources of
package org.apache.log4j.nt;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Layout;
import org.apache.log4j.TTCCLayout;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;
/**
Append to the NT event log system.
<p><b>WARNING</b> This appender can only be installed and used on a
Windows system.
<p>Do not forget to place NTEventLogAppender.dll,
NTEventLogAppender.amd64.dll, NTEventLogAppender.ia64.dll
or NTEventLogAppender.x86.dll as appropriate in a
directory that is on the PATH of the Windows system. Otherwise, you
will get a java.lang.UnsatisfiedLinkError.
@author <a href="mailto:cstaylor@pacbell.net">Chris Taylor</a>
@author <a href="mailto:jim_cakalic@na.biomerieux.com">Jim Cakalic</a> */
so which dll do you potentially need?
I think that depends on your Windows System and I think you need NTEventLogAppender.x86.dll
for any system with a CLR such as XP, Vista or Windows 7/8
Josef
-----Ursprüngliche Nachricht-----
Von: Ricardo Cardoso [mailto:rfonsecacardoso@gmail.com]
Gesendet: Freitag, 13. Juli 2012 15:34
An: log4j-user@logging.apache.org
Betreff: org.apache.log4j.nt.NTEventLogAppender.registerEventSource
Hi my name is Ricardo and I am trying to learn how to use log4j.
I am now trying to learn how to use NTEventLogAppender but without success.
I already put the NTEventLogAppender.dll in windows/system32 folder but
when I run the example code of this dll I get this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.apache.log4j.nt.NTEventLogAppender.registerEventSource(Ljava/lang/St
ring;Ljava/lang/String;)I
at
org.apache.log4j.nt.NTEventLogAppender.registerEventSource(Native
Method)
at
org.apache.log4j.nt.NTEventLogAppender.<init>(NTEventLogAppender.java:79
)
at
org.apache.log4j.nt.NTEventLogAppender.<init>(NTEventLogAppender.java:53
)
at com.log.eventlog.Teste.main(Teste.java:15)
My java code is the following:
BasicConfigurator.configure(new
NTEventLogAppender("ola"));
Logger logger =3D
Logger.getLogger("org.apache.log4j.nt.NTEventLogAppenderTest");
int i =3D 0;
logger.debug( "Message " + i++);
logger.info( "Message " + i++);
logger.warn( "Message " + i++);
logger.error( "Message " + i++);
logger.log(Level.FATAL, "Message " + i++);
logger.debug("Message " + i++, new Exception("Just
testing."));
I know that this can be a silly error but in the internet I only get pages
that show me the NTEventLogAppender class.
Can anyone help me?
Best Regards
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org