I am creating a sample Log4j2 configuration with Asyn Appender, After the executing is complete the thread which is generated by AsyncAppender is not killed? is it a bug or any configuration is explicit to kill the thread.
My sample summary Appender
<!-- ####################### SUMMARY FILE APPENDER ####################### -->
<RollingFile name="SUMMARY_ALL" fileName="./logs/summary.log"
filePattern="logs/$${date:yyyy-MM}/summary-%d{yyyy-MM-dd-HH}-%i.log.gz">
<PatternLayout>
<pattern>%d{ISO8601} [%t] %p %c %L - %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="6"
modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
</RollingFile>
Sample Logger as below
<logger name="com.test.learn" level="DEBUG">
<appender-ref ref="Async" />
</logger>
Sample code package com.test.learn;
import org.apache.logging.log4j.LogManager;
public class TestLogger {
private static org.apache.logging.log4j.Logger log = LogManager
.getLogger(TestLogger.class);
public static void main(String[] args) {
log.info("testing logger");
}
}
after this is executed, the java process should exit, but its not. Can anyone please help me.
I Upgraded to log4j2-beta-9 and it works fine.