Log4j2 is working nicely with Spring Boot through the log4j2.xml
configuration file in the root classpath, exactly as the documentation states.
When try
As mentioned in the log4j2 documentation here, you can include a file named log4j2.component.properties
in your resources folder (or anywhere in the classpath) and inside that file, you can provide the name of the file location (or a new file name) like this:
log4j.configurationFile=path/to/log4j2.xml
or
log4j.configurationFile=classpath:log4j2-custom.xml (if the file is on the classpath)
You can alternatively provide the config file location via the context-param
fields of web.xml
as mentioned here, but I haven't tried that option
(This works with Spring Boot too)