我想从服务器上的客户端应用程序接收日志。 我已经尝试了logback-examples项目中提供的标准“接收器”配置。
<configuration debug="true">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
<receiver class="ch.qos.logback.classic.net.server.ServerSocketReceiver">
<port>6000</port>
</receiver>
</configuration>
当logback分析此文件时,它会出现以下错误:
16:28:09,067 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:76 - no applicable action for [receiver], current pattern is [[configuration][receiver]]
16:28:09,068 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:11 - no applicable action for [port], current pattern is [[configuration][receiver][port]]
我对配置有什么问题感到茫然。 我有:slf4j-api-1.7.5,logback-classic-1.0.9,logback-core-1.0.9
不出所料,客户端日志记录无法发送到服务器:
16:30:39,052 |-INFO in ch.qos.logback.classic.net.SocketAppender[SERVER] - Could not connect to remote logback server at [MAGENTA.comrad.local]. We will try again later. java.net.ConnectException: Connection refused: connect
at java.net.ConnectException: Connection refused: connect
at at java.net.PlainSocketImpl.socketConnect(Native Method)
at at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
答案 0 :(得分:1)
我收到错误的原因是我链接到logback 1.0.9。 接收器功能仅在1.012及更新版本中。