The amount of logging is controlled by categories. Categories are named entities, which follow a hierarchical naming rule similar to Java packages. For example, the category named com.sample is a parent of the category named com.sample.Test .
Similarly, java is a parent of java.util and an ancestor of java.util.Vector.
Let’s see some samples of categories:
<category name="org.apache"> <priority value="INFO"/> </category> <category name="org.jgroups"> <priority value="WARN"/> </category>
The first element limits the verbosity of org.apache packages to INFO , which means that this category will capture all logs in the priority—INFO, WARN, ERROR, and FATAL, but not TRACE and DEBUG levels.
The second one, WARN , is concerned with org.jgroups packages and starts capturing WARN, ERROR, and FATAL messages.
As we said, categories are hierarchical, so a category inherits its configuration from parent categories (unless it defines its own configuration). Similar to Java classes, which are extensions of the object class, all categories inherit from the root logger that resides at the top of the logger hierarchy.
This is the default root category configuration:
<root> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> </root>
The appender-ref elements tell the category which appenders will be used to
send the log messages. By default, JBoss is configured to capture the CONSOLE
and FILE appenders.
Managing logs through JMX agents
If you don’t have access to your configuration files, you can use the JMX console to get/set the logging parameters.
JBoss logging service is managed by Log4jService ( service=Logging,type=Log4jService ) in the jboss.system domain. Open up the JMX agent view pointing to Log4jService .
Besides changing the ConfigurationURL (that is where log4j.xml is placed) a useful parameter is the DefaultJBossServerLogThreshold , which lets you define the default log threshold for your applications.
Setting log4j verbosity in JBoss 5
JBoss AS 5.0 uses the system property jboss.system.log.threshold to define the verbosity of log4j.
By default this property is set to DEBUG (while in previous versions it was set to TRACE).If you want to specify a new setting you can simply issue:
Another way to change this setting is editing the server/xxx/conf/jboss-service.xml file.
Look for the attribute named DefaultJBossServerLogThreshold on the logging service MBean.