开发者

Can someone recommend a good unix syslog *client* library for java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

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 question

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,


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜