Issue Type: Bug Bug
Affects Versions: 1.1.3
Assignee: Logback dev list
Components: logback-classic
Created: 23/Apr/15 10:46 AM
Description:

I'm using SiftingAppender in my application to log processes in different files. Here is my appender:

<property scope="context" name="PROCESS_LOG_HOME" value="processLogs" />
  
	<appender name="PROCESS_LOGGER" class="ch.qos.logback.classic.sift.SiftingAppender">
 
		<timeout>1 minute</timeout>
		
		<discriminator>
			<key>processLogName</key>
			<defaultValue>defaultLog</defaultValue>
		</discriminator>
 
		<sift>
 
		  <appender name="PROCESS-LOGGER-${processLogName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
				<file>${PROCESS_LOG_HOME}/${processLogName}.log</file>
	 
				<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
					<Pattern>
						%d{yyyy-MM-dd HH:mm:ss} %-5level - %msg%n
					</Pattern>
				</encoder>
	 
				<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
					<FileNamePattern>${PROCESS_LOG_HOME}/${processLogName}%d.log</FileNamePattern>
					<!-- keep 7 days worth of history -->
					<MaxHistory>7</MaxHistory>
				</rollingPolicy>
	 
			</appender>
 
		</sift>
	</appender>

In the tasks componing my processes, I get a logger through a static method that sets the MDC variable and then returns the logger, here is the code:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

public class myClass{

	public static Logger getProcessLogger(Exchange exchange, String defaultFileName) {
		initMDCContext(exchange, defaultFileName); //here MDC.put() is called
		Logger processLogger = LoggerFactory
				.getLogger("myLoggerName");
		return processLogger;
	}
}

In the final task of my processes I use the finalize_session_marker:

} finally {
    Logger processLogger = myClass.getProcessLogger(exchange,"someDefaultString");
    processLogger.info(ClassicConstants.FINALIZE_SESSION_MARKER, "About to end the process");
}

All these tasks write correctly in the same file, if they are part of the same process, and at the end of every log i see the row:

2015-04-23 09:46:25 INFO - About to end the process

However the files corresponding my processes are still locked until i stop my application. This means neither the default <timeout>1 minute</timeout> nor ClassicConstants.FINALIZE_SESSION_MARKER are working.

I'm quite new to logback so i don't know what to do to solve this issue.

Environment:

Windows 7

Project: logback
Labels: siftingAppender
Priority: Major Major
Reporter: Enrico Medves
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira