Is there a robust java.util.logging handler implementation of syslog?

心已入冬 提交于 2019-12-03 15:30:10

SLF4J has a bridge for passing java.util.logging events to SLF4J (and hence to log4j or logback) that you could use. It has a performance cost (see the link) but given your load, this shouldn't be a big deal. So you could then use Log4J's SyslogAppender (or better its successor, logback, which also has a SyslogAppender). I do not have any experience with this appender (so this might require some testing) but logback is definitely a reliable library and I know that it can be configured to not print stack traces using the "nopexception" or "nopex" conversion word (in case sending messages when the daemon is down would generate some exception). Coupling this appender with another one (e.g. file based) would allow to not loose any message.

Our project is also using java.util.Logging mechanism, so, after spending some time to find the ready Handler implementation for syslog protocol, I ended up by reading RFC 3164 and creating my own implementation http://code.google.com/p/agafua-syslog/

We using it in production, both with UDP and TCP transports. In our case flow of log messages is approximately 1-2 msg per second, so I guess it is probably applicable for your needs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!