I’m using Log4j in a application in which I also use Axis2 and Jetty web server.
I configured the Log4J property file to exclude these classes from logging when in debug priority. But when I did this, the other priority messages also began to be excluded from the main logger.
Is there a way that I can tell Log4j that I just want to log INFO logs from these classes while logging debug logs from my classes?
Here’s what I have done:
#Jetty Server and Axis2
log4j.category.org.apache.axiom=DEBUG
log4j.additivity.org.apache.axiom=false
log4j.category.org.apache.axis2=DEBUG
log4j.additivity.org.apache.axis2=false
################# MAIN LOGGER #################
log4j.rootCategory=DEBUG, mainLogger
#File configuration
But as I said this configuration also exclude INFO messages from the main logger.
No, set the Root level to DEBUG, and
Also, do not set the additivity to
false.When you’re starting from scratch, you might want to use the more modern XML config format right away. There, it would look like this: