7.6. Enabling Debug Mode for the Agent
The JBoss ON agent, like the JBoss ON server, uses log4j for its logging. To troubleshoot agent performance or server-agent communication, enable debug logging for the agent, which enables the log4j debug log.
The log files are in the
agentRoot/rhq-agent/logs
directory.
7.6.1. Using an Environment Variable Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The quickest way to enable debug logging is to set the
RHQ_AGENT_DEBUG
environment variable to any value before starting the agent. When you start the agent, both the launcher scripts and the agent itself will output debug messages.
If the JBoss ON agent is running on Microsoft Windows using the service wrapper, set
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
RHQ_AGENT_DEBUG
and then install the service:
rhq-agent-wrapper.bat install
rhq-agent-wrapper.bat install
7.6.2. Setting log4j Priorities Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
log4j
categories support priorities for logging levels. This means that different areas of the agent can be configured for different log levels.
Note
Do not set the
RHQ_AGENT_DEBUG
environment variable if you are setting priorities in the log4j.xml
file. The environment variable overrides this log4j.xml
configuration.
To enable debug logging for a category, change the priority value to DEBUG:
- Open the agent
log4j
file:vim agentRoot/rhq-agent/conf/log4j.xml
# vim agentRoot/rhq-agent/conf/log4j.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reset the
priority
element for the category. By default, the agent configuration has logging for both incoming and outgoing server-agent communication and for the baseorg.rhq
class. Optionally, logging can be enabled for plug-in class loaders and JBoss remoting communication.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the agent to load the new configuration.
The
log4j
file format is described more in the Apache log4j documentation.
7.6.3. Using the Agent debug Prompt Command Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Debug logging can be enabled using the debug command in the agent command prompt (Section 7.3.1, “Opening the Agent Command Prompt”).
Using the
--enable
option enables the log4j debug log.
> debug --enable log4j:WARN No appenders could be found for logger (org.rhq.core.pc.measurement.MeasurementCollectorRunner). log4j:WARN Please initialize the log4j system properly. Switched to log file [log4j-debug.xml]. Root log level is [DEBUG] started>
> debug --enable
log4j:WARN No appenders could be found for logger (org.rhq.core.pc.measurement.MeasurementCollectorRunner).
log4j:WARN Please initialize the log4j system properly.
Switched to log file [log4j-debug.xml]. Root log level is [DEBUG]
started>
To enable debug logging specifically for server-agent communication layers, set the
--comm
option to true.
The debug command can also be used to check all of the agent threads, to the server and to the system management handlers, using the
--threaddump
option. This prints the information for each thread, whether the thread is running or any errors that the agent is encountering, per thread. For example: