Log4j.properties doesn't work correctly on wildfly
I have a log4j.properties file on my classpath.
It was found at APP / XX.jar / log4j.properties location.
And I noticed that in the ear file I can also find log4j-1.2.17.jar in the lib folder.
But everything I wrote in the log4j.properties file, they were ignored. How:
log4j.rootCategory=WARN
Or something like this:
log4j.rootCategory=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.logger.org.springframework=WARN
But all records will be printed on the server.
Have I configured them incorrectly or do I have this Wildfly file?
source to share
Given the location of the properties file, it is ignored. If the log4j.properties file is in the directory EAR/META-INF
then WildFly will try to set up log4j for you. He suggested not using it ConsoleAppender
, although it could lead to deadlocks due to the fact that the application trying to write to System.out
and System.out
wrapped in WildFly.
Given the configuration, this leaves you with three options.
- Change the value
add-logging-api-dependencies
tofalse
. - Add
jboss-deployment-structure.xml
and Disable the Deployment Logging Engine - Configure logging through the logging subsystem. This can be done either globally or through a log profile .
source to share