views:

65

answers:

1

java.util.logging.Logger seems to implement "syslog-like" logging, where I want the logs to actually use the local syslog logging fascilities (so life is easier for admins; they don't have to do extra log rotation, etc.).

Anyone have any recommendations? I saw that log4j (http://logging.apache.org/log4j/1.2) claimed they had syslog support but the API it exposes is nothing like syslog(8).

Thanks in advance,

+4  A: 

Log4j can do it

Look at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html

and

http://wiki.apache.org/logging-log4j/syslog

Your code will look like

private static Logger logger = Logger.getLogger( MyClass.class );

...

logger.warn( "This is a warning!" );

and the correct log4j.properties file will redirect to syslog

bwawok