In both of those log files Log4j is not seeing any value as being set of log4j.configurationFile. It is ending up using the default configuration.
Ralph > On Oct 15, 2022, at 3:45 PM, Joan ventusproxy > <joan.balagu...@ventusproxy.com> wrote: > > Hi Piotr, > > Thanks for your quick response. > > Below two gists with the traces for both cases: > > 1. Using "this.systemLog = LogManager.getLogger("LOGGER_SYSTEM");": > https://gist.githubusercontent.com/joanbalaguero/a59fb664774c44535c10817900a80ed5/raw/8bb6b6a963a607f0d99105248ce32a28ad39590a/gistfile1.txt > > In this case logs are not created. > > > 2. Using "this.systemLog = > LogManager.getContext().getLogger("LOGGER_SYSTEM");": > https://gist.githubusercontent.com/joanbalaguero/acd0a4edaf856ad34c44a196caef7bdc/raw/474febc0397b97a9b941dbd86b830149ac94ad07/gistfile1.txt > > In this case logs are created and content is logged into them correctly, but > the hazelcast log (from "com.hazelcast") is not sent to the SYSTEM_LOG. > > > The " log4j.configurationFile " variable is set in this way: > System.setProperty("log4j.configurationFile", > "/opt/ventusproxy/app/proxy/ROOT/WEB-INF/log4j.xml"); > > And tomcat starts with: > -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector > > > The point is that for years we have been running this without issues using > point 1, without getting the context from the LogManager. > > One more clue. As I said, this is not working fine on our new installation > with Centos9 Stream, Apache Tomcat 8.5.83 and Zing JVM 11. Exactly the same > code running locally on a windows 10 with Apache Tomcat 8.5.39 and Oracle jdk > 11 works perfectly, logs are created and the hazelcast logging is sent to the > SYSTEM_LOG. > > > Thanks, > > Joan. > > -----Original Message----- > From: Piotr P. Karwasz <piotr.karw...@gmail.com> > Sent: Friday, October 14, 2022 5:23 PM > To: Log4J Users List <log4j-user@logging.apache.org> > Subject: Re: Issue after moving to log4j 2.19 > > Hi Joan, > >> 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"); > > This looks like a `LoggerContextSelector` problem: > https://logging.apache.org/log4j/2.x/manual/extending.html#ContextSelector > > `LogManager.getContext()` should not be used, because it gives you the wrong > logger context most of the time. > The automatic configuration uses `LogManager.getContext(false)` to retrieve > the right logger context. > > Can you run your application with `-Dlog4j2.debug=true` and share the output? > > Piotr > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org