logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joan Balagueró - ventusproxy <joan.balagu...@ventusproxy.com>
Subject How to put working 2 separate log4j2 xml files within the same web app
Date Fri, 08 Feb 2019 10:35:12 GMT
Hello,

 

This is a crosspost, already asked in StackOverflow, no success
(https://stackoverflow.com/questions/54535220/how-to-put-working-2-separate-
log4j2-xml-files)

 

As a briefing, the question  would be how we can have 2 log4j2
configurations working at the same time within the same web application.

 

The main web app configures a log4j2 using below when it starts (and works):

System.setProperty("log.dir", dirLogs);

System.setProperty("log4j.configurationFile", "file://" + servletPath +
"WEB-INF/log4j.xml");

this.accessLog = LogManager.getLogger("LOGGER_ACCESS");

 

After this, a user can dynamically upload jars that also use log4j. The main
webapp doesn’t know anything about these jars, it just uploads them. This is
one example of a user setting up log4j2 within his webapp:

System.setProperty("log4j.configurationFile",
"file:///home/ventus/logs/confirms/log4j_confirms.xml");
confirmLog = LogManager.getLogger("LOGGER_CONFIRM");

 

The problem is this second configuration does not work:

confirmLog = LOGGER_CONFIRM:OFF in AsyncContext@4c23524b
confirmLogClass = org.apache.logging.log4j.core.async.AsyncLogger

 

 

Is there any way to solve this? I’m probably doing something wrong.

 

Thanks,

 

Joan.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message