Can someone recommend a good unix syslog *client* library for java? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
开发者_运维百科 Improve this questionjava.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,
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
精彩评论