Hi again,
Did anyone else come across the same problem? How did you solve it? Are my settings in log4j.properties
correct?
I really need your help as my mini-project hit the wall.
Thank you to all in advance,
Alex.
-----Original Message-----
From: Akoulov, Alexandre [IT]
Sent: Thursday, 10 February 2005 4:22 PM
To: log4j-user@logging.apache.org
Subject: Cannot log into UNIX Syslog
Hi all,
I am trying to log application error messages into syslog using log4j and so far I have no
success. I've read and searched a lot of information but could not find an answer.
PROBLEM DESCRIPTION:
The application runs on the same machine as syslog. That is what my log4j.properties file
looks like:
===========================================================================
# Make root logger to log everything using A1 appender
log4j.rootLogger=DEBUG, A1
# This is an event logger that logs into a file
log4j.logger.com.SSMB.EbbosDatabase.InfoLogger=INFO, EVENT_FILE
# This an error logger that logs into a file
log4j.logger.com.SSMB.EbbosDatabase.ErrorLogger=ERROR, ERROR_FILE
# This is an error logger that logs into syslog
log4j.logger.com.SSMB.EbbosDatabase.SyslogLogger=ERROR, SYSLOG
.....<configuring appenders for A1, EVENT_FILE, ERROR_FILE>.....
# --SYSLOG--
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
# Define a server where syslog lives
log4j.appender.SYSLOG.syslogHost=localhost
# Define a pipe (logging facility)
log4j.appender.SYSLOG.Facility=LOCAL5
# Uncomment the following line if need printed message to include the facility name of the
application
#log4j.appender.SYSLOG.FacilityPrinting=true
# Define message format
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
# day thread warning level loggerName - message
log4j.appender.SYSLOG.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
===========================================================================
While file loggers (InfoLogger and ErrorLogger) log the messages into their respective files,
the syslog logger (SyslogLogger) does not:
===========================================================================
infoLogger.info("Test from info logger"); // successfully logs a message
errorLogger.error("Test from error logger"); // successfully logs a message
syslogLogger.error("Test from syslog logger"); // UNSUCCESSFUL :(
===========================================================================
On the same unix box I ran the following unix command in order to test whether can log into
syslog at all:
===========================================================================
logger -p local5.err "just testing syslog functionality"
===========================================================================
and it was successful - I could see this "just testing syslog functionality" in a syslog file.
Thank you to all in advance for your thoughts on how to solve this problem.
Kind regards,
Alexandre Akoulov.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
|