我正在尝试LogstashTcpSocketAppender
通过logback-spring.xml
. 当我将这些行添加 <stackTrace>
到LogstashEncoder
我得到一个错误 Error is: "weblogic.application.ModuleException: java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.spi.Interpreter@51:25 - no applicable action for [stackTrace], current ElementPath is [[configuration][appender][encoder][stackTrace]]
。如果我删除<stackTrace><fieldName>stackTrace</fieldName>
并只保留<throwableConverter>
它可以正常工作。任何帮助都深表感谢。
logback-spring.xml
<appender name="LOGSTASH"
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>${LOGSTASH_HOST}:${LOGSTASH_PORT}</destination>
<encoder charset="UTF-8"
class="net.logstash.logback.encoder.LogstashEncoder">
<stackTrace>
<fieldName>stackTrace</fieldName>
<throwableConverter
class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
</throwableConverter>
</stackTrace>
</encoder>
</appender>
<appender name="ASYNC_LOGSTASH"
class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="LOGSTASH"/>
</appender>
错误日志:
Caused By: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@51:25 - no applicable action for [stackTrace], current ElementPath is [[configuration][appender][encoder][stackTrace]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@52:28 - no applicable action for [fieldName], current ElementPath is [[configuration][appender][encoder][stackTrace][fieldName]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:166)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:82)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:114)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:264)
Truncated. see log file for complete stacktrace