I have a logback.xml with the below contents
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10000">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="com.myFilter.filters.CustomJsonLayout">
<jsonFormatter class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
<prettyPrint>false</prettyPrint>
</jsonFormatter>
<appendLineSeparator>true</appendLineSeparator>
</layout>
</appender>
<logger name="com.third.party" level="INFO" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="com.cassandra" level="INFO" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="com.sql" level="INFO" additivity="false">
<appender-ref ref="CONSOLE"=/>
</logger>
<logger name="SESSION_ATTRIBUTE_LOG" level="INFO" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="OPS_LOG" additivity="false" level="INFO">
<appender-ref ref="CONSOLE"/>
</logger>
<jmxConfigurator contextName="MyConfig"/>
</configuration>
Here the CustomJsonLayout class is created for our specific purpose of logging, and its working fine.
The issue is all the logs are logging to the console and I am not able to differentiate, which log is logging it like whether its thridparty or sql or myapp. Is there any way to overcome this issue ?
my log output looks like
{
"timestamp": "1554710406746",
"level": "INFO",
"thread": "http-nio-8082-exec-12",
"domain": "docker.for.mac.localhost",
"user_agent": "Styx/1.0-1032",
"akamai_bot": "",
"request_method": "GET",
"url": "/version.txt",
"remote_host": "127.0.0.1",
"edgescape": "",
"logger": "com.filter.guid.GuidFilter",
"message": "New GUID=ab3f9b75-27b8-4f13-b8e7-e1320c0d0c85 generated for requestUri=/version.txt",
"context": "default"
}