Nobody has an idea?
-----Original Message-----
From: Berwanger, Christian [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 8. Juli 2008 12:15
To: [email protected]
Subject: Syslog message is sent twice in the case no log4j configuration
file is used
Hi log4j comunity,
I'm using the log4j appender in order to send my log message to a remote
host. I decided not to use the config file because the application
itself is already using a central config file which I want to use to
read my configurable data (like hostname, port...). However when I'm
using the log4j API without config file the message is sent twice times.
I read and tried already the hints on the tutorial sites without success
which threads several ideas for the problem of multiple same messages.
m_logger = Logger.getLogger(SecurityEvent.class.getName());
m_logger.setAdditivity(false);
m_syslogAppender = new SyslogAppender();
m_syslogAppender.activateOptions();
m_syslogAppender.setLayout(new PatternLayout("%c: %m%n"));
m_syslogAppender.setSyslogHost("localhost");
m_logger.addAppender(m_syslogAppender);
m_syslogAppender.setFacility(mapFacilityID(this.m_facility));
sendLogMessage(logMessage);
m_logger.removeAllAppenders();
However when I tried following configuration file instead it worked
fine.
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.net.SyslogAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.SyslogHost=localhost
log4j.appender.A1.layout.ConversionPattern=%c: %m%n
How can I get only ONE log message?
Thanks for all help
Christian
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
any attachment and all copies and inform the sender. Thank you.
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]