[logback-dev] [JIRA] Updates for LOGBACK-1713: AppenderFactory not set in SiftingAppender

QOS.CH (JIRA) noreply-jira at qos.ch
Tue Dec 13 14:31:00 CET 2022


logback / LOGBACK-1713 [Open]
AppenderFactory not set in SiftingAppender

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1713

==============================
 Issue created
------------------------------

Andree Wormuth created this issue on 13/Dec/22 2:19 PM
Summary:              AppenderFactory not set in SiftingAppender
Issue Type:           Bug
Affects Versions:     1.4.5
Assignee:             Logback dev list
Components:           logback-classic
Created:              13/Dec/22 2:19 PM
Environment:
  Classic Spring Web Application (no Spring Boot)
   Tomcat 9
   Java 17
Priority:             Major
Reporter:             Andree Wormuth
Description:
  We use the {{ch.qos.logback.classic.sift.SiftingAppender}} to create a separate log file for each of our imports. For that end we create a property {{importLogFile}} and put it into the {{MDC}}, the config looks as follows:
  {code:xml}
  <appender name="MyImport" class="ch.qos.logback.classic.sift.SiftingAppender">
  	<discriminator>
  		<key>importLogFile</key>
  		<defaultValue>undefined</defaultValue>
  	</discriminator>
  	<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
  		<evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
  			<expression>
                  return mdc == null || mdc.get("importLogFile") == null;
              </expression>
  		</evaluator>
  		<OnMismatch>NEUTRAL</OnMismatch>
  		<OnMatch>DENY</OnMatch>
  	</filter>
  	<sift>
  		<appender name="FILE-${importLogFile}" class="ch.qos.logback.core.FileAppender">
  			<file>${importLogFile}</file>
  			<append>false</append>
  			<layout class="ch.qos.logback.classic.PatternLayout">
  				<pattern>%d %level %logger{35} - %msg%n</pattern>
  			</layout>
  		</appender>
  	</sift>
  </appender>
  {code}
  We followed the docs in that matter, see [here|https://logback.qos.ch/manual/appenders.html#SiftingAppender].
  
  This worked flawlessly while we were using logback *1.2.x*. With the update to version *1.3* though, the initialization process seems to have changed. We're trying to use the latest version (1.4.5 ({{ch.qos.logback:logback-classic:1.4.5}}), and now instead of separate log files we get following error message during startup of our web app:
  {noformat}
  Appender named [FILE-importLogFile_IS_UNDEFINED] not referenced. Skipping further processing.
  ERROR in ch.qos.logback.classic.sift.SiftingAppender[MyImport] - AppenderFactory has not been set. Aborting
  {noformat}
  I did not find a solution for this in the logback docs. There were changes concerning the usage of nested appenders (some other log messages indicate as much) but as far as I understand the {{SiftingAppender}} does not really fall under that category - and the docs mentioned above haven't been changed, so I guess that approach should still be valid.


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the logback-dev mailing list