How to increase debug logging to investigate remote agent problems
Purpose
This knowledge base article is intended to help in troubleshooting agent problems by increasing the logged information on the server and/or agent logs.
Solution for Bamboo versions prior to 9
Option1: Debug server and agent (requires a server restart)
- Edit the <Bamboo-Install>/atlassian-bamboo/WEB-INF/classes/log4j.properties.
The debug classes can be added on demand in your log4j.properties file depending on what problem is being troubleshot:
Subject Classes to debug Agent Registration log4j.category.com.atlassian.bamboo.agent=DEBUG
log4j.category.com.atlassian.bamboo.v2.build.agent=DEBUG
log4j.category.com.atlassian.bamboo.buildqueue.manager.RemoteAgentManagerImpl=DEBUG
Agent load log4j.category.org.apache.activemq=DEBUG
External process log4j.category.com.atlassian.utils.process=DEBUG
log4j.logger.com.atlassian.bamboo.executor=DEBUG
Git log4j.logger.com.atlassian.bamboo.plugins.git.GitRepository=DEBUG
Artifact transfer log4j.logger.com.atlassian.bamboo.v2.build.agent.messages.ArtifactStreams=DEBUG
log4j.logger.com.atlassian.bamboo.build.artifact=DEBUG
log4j.logger.com.atlassian.bamboo.build.artifact.BambooArtifactHttpTransport=DEBUG
Restart both server and agent (the above-debugging classes will also take effect on agent logs after the restart)
Option2: Debug only the agent
If you cannot restart your server, you can enable logging only on the agent side with the following steps:
- Stop the Agent
- Copy the <bamboo-install>/atlassian-bamboo/WEB-INF/classes/log4j.properties file from the Server to the Agent's <bamboo-agent-home>
- Edit the log4j.properties on the Agent
Modify the following property from OFF to ON
log4j.appender.console.threshold = ON
- Edit the log4j.properties based on debugging classes suggested in the table above
Configure your agent to load the log4j.properties file:
Uncomment the line following line on <bamboo-agent-home>/conf/wrapper.conf and add the absolute path to the log4j.properties file you just created:
#wrapper.java.additional.3=-Dlog4j.configuration=
It should look like this after the change:
wrapper.java.additional.3=-Dlog4j.configuration=<bamboo-agent-home>/log4j.properties
- Restart the agent
Solution for Bamboo version 9 and above
Option1: Debug server and agent (requires a server restart)
- Edit the <Bamboo-Install>/atlassian-bamboo/WEB-INF/classes/log4j2.properties.
The debug classes can be added on demand in your log4j2.properties file depending on what problem is being troubleshot:
Subject Classes to debug Agent Registration logger.agent-added.level=DEBUG
logger.agent-added.name=com.atlassian.bamboo.agent
logger.buildqueue-added.level=DEBUG
logger.buildqueue-added.name=com.atlassian.bamboo.buildqueue
logger.buildagent-added.level=DEBUG
logger.buildagent-added.name=com.atlassian.bamboo.v2.build.agent
Agent load logger.activemq-added.level=DEBUG
logger.activemq-added.name=org.apache.activemq
External process logger.utils-added.level=DEBUG
logger.utils-added.name=com.atlassian.utils.process
logger.executor-added.level=DEBUG
logger.executor-added.name=com.atlassian.bamboo.executor
Git logger.git-added.level=DEBUG
logger.git-added.name=com.atlassian.bamboo.plugins.git.GitRepository
Artifact transfer logger.artifact-streams.level=DEBUG
logger.artifact-streams.name=com.atlassian.bamboo.v2.build.agent.messages.ArtifactStreams
logger.artifact.level=DEBUG
logger.artifact.name=com.atlassian.bamboo.build.artifact
logger.artifact-http-transport.level=DEBUG
logger.artifact-http-transport.name=com.atlassian.bamboo.build.artifact.BambooArtifactHttpTransport
Restart both server and agent (the above-debugging classes will also take effect on agent logs after the restart)
Option2: Debug only the agent
If you cannot restart your server, you can enable logging only on the agent side with the following steps:
- Stop the Agent
- Copy the <bamboo-install>/atlassian-bamboo/WEB-INF/classes/log4j2.properties file from the Server to the Agent's <bamboo-agent-home>
- Edit the log4j2.properties on the Agent
Modify the following property from OFF to ON
appender.console.filter.threshold.level = ON
- Edit the log4j2.properties based on debugging classes suggested in the table above
Configure your agent to load the log4j2.properties file:
Uncomment the line following line on <bamboo-agent-home>/conf/wrapper.conf and add the absolute path to the log4j2.properties file you just copied:#wrapper.java.additional.3=-Dlog4j2.configurationFile
It should look like this after the change:
wrapper.java.additional.3=-Dlog4j2.configurationFile=<AGENT_HOME>/log4j2.properties
- Restart the agent
For more info on how to increase log verbosity on remote agents:
Extra debugging: Investigating packet content
For a deeper investigation of packet content, network traffic dumps between the agent and the server are helpful.
Please enable the network packet capturing on the server side and reproduce the problem. Please refer to Capturing HTTP traffic using Wireshark or Fiddler for more details on how to capture the network packet.