Hi Folk!
Faced with next issue. In our peoject wants to use LogstashEncoder to get logging data in json format.
Was added configuration to logback.xml file
appender for write to File
<appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDir}/app.log</file>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${logDir}/app.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} %X{cubaApp} %X{cubaUser} - %msg %n%highlight</pattern>
</encoder>
</appender>
appender for write to Concole
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} %X{cubaApp} %X{cubaUser} - %msg %n%highlight</pattern>
</encoder>
</appender>
Added dependency to build.gradle
implementation("net.logstash.logback:logstash-logback-encoder:7.3")
after successfull buildб while starting jar file we getting next log with exceptions. (attached)
log_issue_with_LogstashEncoder.txt (12.9 KB)
Stack: Java 11, cuba_varsion 7.2.13
- Format source code in your posts by wrapping it in triple backquotes (```).