Below is the configuration of logback.xml I tried many ways but it does not encode or print Logger.error statements
<configuration>
<property name="LOG_PATH" value="/tmp/json-log.json" />
<appender name="jsonAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_PATH}</File>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>1</maxIndex>
<fileNamePattern>${LOG_PATH}.%i</fileNamePattern>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>1MB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="jsonLogger" additivity="false" level="DEBUG">
<appender-ref ref="jsonAppender"/>
</logger>
<root level="INFO">
<appender-ref ref="jsonAppender"/>
</root>
<root level="error">
<appender-ref ref="jsonAppender" />
</root>
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<logger name="jsonLogger" additivity="false" level="DEBUG">
<appender-ref ref="consoleAppender"/>
</logger>
<root level="INFO">
<appender-ref ref="consoleAppender"/>
</root>
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<target>System.err</target>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
</encoder>
</appender>
<root level="ERROR">
<appender-ref ref="STDERR" />
</root>