问题
How to use slf4j with graylog as a wrapper ? we can use log4j with slf4j. I am looking for a good graylog framework can any please say can we use graylog with slf4j ?
回答1:
It's not entirely clear what you're asking. SLF4J is a logging API. Log4j and Logback are implementations of that API (Log4j is also a standalone logging framework, of course). Graylog is a log aggregator.
If you want to use SLF4J to send logging to Graylog, you will need an implementation that can somehow send log messages over syslog in Graylog's GELF format. I don't know of any implementation which does that natively, but there are extensions for both Logback and Log4j to do this:
- https://github.com/Moocar/logback-gelf for Logback
- https://github.com/t0xa/gelfj for Log4j
回答2:
Logback is intended as a successor to the popular log4j project. logback-classic natively implements the SLF4J API.
about logback and Graylog2, pleade read https://github.com/Moocar/logback-gelf
来源:https://stackoverflow.com/questions/20001739/using-logback-with-slf4j