与slf4j一起使用Logback [英] using Logback with slf4j

查看:358
本文介绍了与slf4j一起使用Logback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将slf4j与graylog用作包装器? 我们可以将log4j与slf4j一起使用.我正在寻找一个好的Graylog框架,请问可以在slf4j中使用graylog吗?

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 ?

推荐答案

目前还不清楚您要问什么. SLF4J是一个日志记录API. Log4j和Logback是该API的实现(当然Log4j也是一个独立的日志记录框架). Graylog是一个日志聚合器.

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.

如果要使用SLF4J将日志发送到Graylog,则需要一个实现,该实现可以某种方式通过Graylog GELF格式的syslog发送日志消息.我不知道有任何本地执行的实现,但是Logback和Log4j都有扩展名可以做到这一点:

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

这篇关于与slf4j一起使用Logback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆