Hello,

 �

We have moved to log4j 2.19.0 from log4j 2.17.2. Our environment is Centos9 
stream with tomcat 8.5.83 and jdk11. After doing that, logging has stopped 
working (the code related to log4j2 has not been changed for years)

 �

All our loggers are asynchronous by adding:

-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

 �

The piece of log4j.xml:

 �

<Appenders>

  <RollingFile name="SYSTEM_LOG" fileName="${sys:log.dir}vproxy_system" 
filePattern="${sys:log.dir}vproxy_system.%d{yyyy-MM-dd}" append="true" 
immediateFlush="true">

<PatternLayout>

     <Pattern>%d{yyyy-MM-dd HH:mm:ss}\t%m%n</Pattern>

</PatternLayout>

<Policies>

    <CronTriggeringPolicy schedule="0 0 0 * * ?" evaluateOnStartup="true" />

</Policies>

</RollingFile>

</Appenders>

 �

<Loggers>

   <Root level="off" additivity="false" />

   <Logger name="LOGGER_SYSTEM" level="info" includeLocation="false" 
additivity="false">

     <AppenderRef ref="SYSTEM_LOG"/>

   </Logger>

 �

  <Logger name="com.hazelcast" level="all" includeLocation="false" 
additivity="false">

     <AppenderRef ref="SYSTEM_LOG"/>

   </Logger> 

</Loggers>

 �

Adding this before log creation:

System.setProperty("log4j2.debug", "true"); 

 �

We only got this when we printed the variable that should contain the system 
logger:

LOGGER_SYSTEM:ERROR in AsyncContext@587d32cc

 �

After making a lot of tests trying to get this working again, we had to change 
the line below:

this.systemLog = LogManager.getLogger("LOGGER_SYSTEM");

 �

By this:

this.systemLog = LogManager.getContext().getLogger("LOGGER_SYSTEM");

 �

And now it is almost working again, because the hazelcast log is not sent to 
the system logger yet. So our questions are:

 �

1.      Why must we get the logger from the context now? What has changed?
2.      What should we do to get the hazelcast logging working again, so send 
it to the system logger correctly.

 �

 �

Thanks,

 �

Joan.

Reply via email to