But these other 2 wars already have log4j2 jars bundled with these. I mean in WEB-INF/lib of these wars, log4j2 jars are available and even the version is also different which is log4j2 2.17.1 while my application is using 2.17.2.
Get Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: Ralph Goers <ralph.go...@dslextreme.com> Sent: Wednesday, April 6, 2022 11:54:26 PM To: Log4J Users List <log4j-user@logging.apache.org> Subject: Re: can we set log4j property 'Log4jContextSelector' per webapps war *** External email: Verify sender before opening attachments or links *** OK. If all 3 wars are using the same Log4j jars then you can only have a single ContextSelector. Ralph > On Apr 6, 2022, at 11:17 AM, Pooja Pandey <pooja.pan...@asg.com.INVALID> > wrote: > > Webapps wars path is like: installation directory/soa-dir/webapps/ > > Along with various other product libs, log4j2 jars and log4j2 propertie file > are placed under soa-dir/lib. This path is accessible by all 3 wars. I cannot > make any changes in 2 wars which we are fetching from artifactory. > > > > Get Outlook for iOS<https://aka.ms/o0ukef> > ________________________________ > From: Ralph Goers <ralph.go...@dslextreme.com> > Sent: Wednesday, April 6, 2022 11:33:55 PM > To: Log4J Users List <log4j-user@logging.apache.org> > Subject: Re: can we set log4j property 'Log4jContextSelector' per webapps war > > *** External email: Verify sender before opening attachments or links *** > > > Where are the Log4j jars located? > > Ralph > >> On Apr 6, 2022, at 6:34 AM, Pooja Pandey <pooja.pan...@asg.com.INVALID> >> wrote: >> >> Hi, >> >> In my application, I have 2 processes running and there are 3 webapps war >> files which get deployed in tomcat version 9.0.60. Out of these 3 war files, >> one war file is internal to my application while other 2 are coming as final >> artifacts from artifiactory. >> >> My war uses a custom logger and custom ContextSelector, however other 2 wars >> from artifactory uses standard logger and standard ContextSelector. >> >> I have defined below system property as a static block in custom logger, >> however for some unknown reason when my war gets deployed this log4j jars >> don't find this property and leads to ClassCastException >> "java.lang.ClassCastException: >> org.apache.logging.log4j.core.selector.ContextSelector cannot be cast to >> logger.log4j2.CustomLog4j2ContextSelector". To fix this I have placed >> 'log4j2.component.properties' file on log4j jars class path, but with this >> fix, following harmless error get logged for other 2 wars >> "java.lang.ClassCastException: Cannot cast >> logger.log4j2.CustomLog4j2ContextSelector to >> org.apache.logging.log4j.core.selector.ContextSelector". >> >> I am looking for help to come up with a solution where, when my war gets >> deployed then custom logger context >> "logger.log4j2.CustomLog4j2ContextSelector" should be used while when other >> 2 wars get deployed then >> "org.apache.logging.log4j.core.selector.ContextSelector" should be used. >> Please let me know if you have any idea on this. >> >> static { >> System.setProperty("Log4jContextSelector", >> "logger.log4j2.CustomLog4j2ContextSelector"); >> } >> >> >> Content of file 'log4j2.component.properties' -> >> Log4jContextSelector=logger.log4j2.CustomLog4j2ContextSelector > > > --------------------------------------------------------------------- > 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