2017-04-19 68 views
0

如何添加刪除服務器appender進行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 

回答

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>