Skip to content

Log4j2 not working with tomcat and JULI #2092

Discussion options

You must be logged in to vote

Finally this worked. Something is wrong with LoggerContext so I had to set it manually.

File file = new File("/Users/mehul/Repos/mehul/app/webServices-serv/src/main/resources/log4j2.properties");
            LoggerContext context = (LoggerContext) LogManager.getContext(false);
            context.setConfigLocation(file.toURI());
            this.logger = LogManager.getLogger(clazz);

URI is also not coming as null and giving the proper path of file

DEBUG StatusLogger Reconfiguration complete for context[name=59d4cd39] at URI /Users/mehul/Repos/mehul/app/webServices-serv/src/main/resources/log4j2.properties(org.apache.logging.log4j.core.LoggerContext@58bf02b1) with optional ClassLoader: null

Replies: 2 comments 20 replies

Comment options

You must be logged in to vote
20 replies
@mehulparmariitr
Comment options

@ppkarwasz
Comment options

@mehulparmariitr
Comment options

@mehulparmariitr
Comment options

Answer selected by mehulparmariitr
@ppkarwasz
Comment options

@mehulparmariitr
Comment options

@ppkarwasz
Comment options

@mehulparmariitr
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants