Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
1.1.2
-
None
Description
By configuring an application with both an AsyncAppender and a ConsoleAppender, the includeCallerData property of AsyncAppender will always be true, no mather if it's omitted or explicitly set to false.
This problem came to my attention after implementing the AsyncAppender in production. I had forgotten to set includeCallerData to true and hence the application was logging question marks . When I implemented the AsyncAppender in a testing environment along with the ConsoleAppender before setting includeCallerData to true, the question marks were replaced correctly.
Example configuration:
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true"> <appender name="Console" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d %-4p [%X{uow}-%X{requestId}] [%t] [%X{group}] (%F:%L\) : %msg%n</pattern> </encoder> </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>/tmp/app.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- daily rollover --> <fileNamePattern>notifier.%d{yyyy-MM-dd}.log</fileNamePattern> <!-- keep 30 days' worth of history --> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern>%d %-4p [%X{uow}-%X{requestId}] [%t] [%X{group}] (%F:%L\) : %msg%n</pattern> </encoder> </appender> <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="FILE" /> <includeCallerData>false</includeCallerData> </appender> <root level="INFO"> <appender-ref ref="Console" /> <appender-ref ref="ASYNC" /> </root> </configuration>