[logback-dev] [JIRA] Created: (LBCLASSIC-312) SiftingAppender does not substitute variable value inside sift

Dmitrius Listo (JIRA) noreply-jira at qos.ch
Wed Dec 7 21:40:12 CET 2011

SiftingAppender does not substitute variable value inside sift

                 Key: LBCLASSIC-312
                 URL: http://jira.qos.ch/browse/LBCLASSIC-312
             Project: logback-classic
          Issue Type: Bug
          Components: appender
    Affects Versions: 1.0.0
         Environment: Ubuntu 11.04,  Eclipse 3.7
            Reporter: Dmitrius Listo
            Assignee: Logback dev list

Faced a probable bug (at least, did not find any mention about such issue at manual/google/other bugs in category).

Brief logging configuration description:
I have a property defined in my logback configuration. 
There is a property with log file location defined:
<property name="LOG_HOME" value="/tmp/aicore" />
Also, I have ConsoleAppender and two RollingFileAppender appenders, attached to root logger.  RollingFileAppender configuration contains LOG_HOME variable in path and substitution is done without any issues, log file is created and updated.
But when I add SiftingAppender (log files are created on per-threadId basis), that contains FileAppender in it's sift section, variable value is not substituted.
Here is the logback log fragment, generated using OnConsoleStatusListener:

22:11:27,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
22:11:27,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE-server]
22:11:27,398 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
22:11:27,400 |-INFO in ch.qos.logback.core.FileAppender[FILE-server] - File property is set to [LOG_HOME_IS_UNDEFINED/thread-server.log]

Note the "LOG_HOME_IS_UNDEFINED/thread-server.log" value. As a result, no any sift log file is created in expected location. When I substitute ${LOG_HOME} value manually, everything works well. 

Below is my SiftingAppender config:

	<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
		<discriminator class="ch.qos.logback.classic.sift.MDCBasedDiscriminator">
			<appender name="FILE-${threadId}" class="ch.qos.logback.core.FileAppender">
		          <pattern>%d [%thread] %level %mdc %logger{35} - %msg%n</pattern>

Sorry if bug report is not formed perfectly, I have not much expertise yet :)

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the logback-dev mailing list