用于Logback的远程服务器Appender

时间:2017-04-19 05:41:48

标签: java log4j logback

如何配置logback以将日志消息发送到远程服务器appender?

例如,在log4j中,我可以在log4j属性文件中使用以下内容。

log4j.rootLogger=server
# Redirect logs
log4j.appender.server=org.apache.log4j.net.SocketAppender
log4j.appender.server.Port=3501
log4j.appender.server.RemoteHost=127.0.0.1
log4j.appender.server.ReconnectionDelay=30000

1 个答案:

答案 0 :(得分:0)

找到它,

<configuration>

      <appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
        <remoteHost>${host}</remoteHost>
        <port>${port}</port>
        <reconnectionDelay>10000</reconnectionDelay>
        <includeCallerData>${includeCallerData}</includeCallerData>
      </appender>

      <root level="DEBUG">
        <appender-ref ref="SOCKET" />
      </root>  

</configuration>