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 "Akoulov, Alexandre [IT]" <al...@citigroup.com> on 2005/02/13 03:45:25 UTC

RE: Cannot log into UNIX Syslog (with org.apache.log4j.net.SyslogAppender)

Hi all,

I am still trying to solve "cannot log into UNIX Syslog" (please see original email below). I've turned the log4j debug on (with the -Dlog4j.debug option) and that is what I have


log4j: Parsing for [com.SSMB.EbbosDatabase.ErrorExternalLogger] with value=[ERROR, SYSLOG].
log4j: Level token is [ERROR].
log4j: Category com.SSMB.EbbosDatabase.ErrorExternalLogger set to ERROR
log4j: Parsing appender named "SYSLOG".
log4j: Parsing layout options for "SYSLOG".
log4j: Setting property [conversionPattern] to [%d [%t] %-5p %c - %m%n].
log4j: End of parsing for "SYSLOG".
log4j: Setting property [syslogHost] to [localhost].
log4j: Setting property [facility] to [LOCAL5].
log4j: Parsed "SYSLOG" options.


As you can see all looks all right. What would you recommend I should do next? I really need some help on how to solve this problem.


Thanks 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