To debug an issue, increase the log level for Continuous Delivery for Puppet Enterprise to capture TRACE level messages.
Version and installation information
Product: Continuous Delivery for Puppet Enterprise
Version: 3.2.0 and later 3.x
Installation type: puppetlabs-cd4pe
module managed installation
Solution
First, configure Continuous Delivery for PE so that you can set the log level, and then set the log level to TRACE.
Part one: Configure Continuous Delivery for PE so that you can set the log level
In these steps, you’ll override the default location for Continuous Delivery for PE Log4j logs so that you can change the log level as needed.
On the host running the Continuous Delivery for PE container:
-
Create a configuration directory:
mkdir -p /etc/puppetlabs/cd4pe/config
-
Copy the Docker container’s default logging configuration file into the configuration directory:
docker exec -it cd4pe cat /etc/service/pfi/log4j.properties > /etc/puppetlabs/cd4pe/config/log4j.properties
-
Create
/etc/puppetlabs/cd4pe/env-extra
and add the lineJVM_ARGS=-Dlog4j.configurationFile=/config/log4j.properties
:# cat /etc/puppetlabs/cd4pe/env-extra JVM_ARGS=-Dlog4j.configurationFile=/config/log4j.properties
-
Allow the Docker container to read the logging file by updating a parameter in the console to map the configuration file to the Docker container and force it to read in the information in
env-extra
.-
In the console, click Classification, and select the PE Infrastructure node group, and then click the Continuous Delivery for PE node group.
Note: The name of the Continuous Delivery for PE node group might be different if you changed it from the default name
-
On the Configuration tab, find the
cd4pe
class associated with the Continuous Delivery for PE node. Select thecd4pe_docker_extra_params
Parameter name from the list. Add or update the value of that parameter to include the strings"-v /etc/puppetlabs/cd4pe/config:/config"
and"--env-file /etc/puppetlabs/cd4pe/env-extra"
Make sure to format the values as an array, for example:
["--add-host gitlab.puppetdebug.vlan:10.32.47.33","-v /etc/puppetlabs/cd4pe/config:/config","--env-file /etc/puppetlabs/cd4pe/env-extra"]
-
Click Add parameter and commit changes.
-
On the Continuous Delivery for Puppet Enterprise node, run Puppet:
puppet agent -t
-
-
To confirm the configuration change was successful, on the Continuous Delivery for PE node check the process table and ensure that
log4j.configurationFile
is set to/config/log4j.properties
:# pgrep -af \^pfi
8817 pfi -cp /etc/service/pfi/lib/* -Dlog4j.configurationFile=/config/log4j.properties com.puppet.pipelines.pfi.PipelinesInfra --name PipelinesInfra --port 8080 --stage prod --config=/etc/pfi-config.json --monitor-task-queue
Part two: Change the log level
Once logging is configured, you can change the log level.
In this example, the log level is increased to get more information on communication between Continuous Delivery for PE and Puppet Enterprise.
Note: The log4j.properties
file that you copied earlier contains more information about other information that you can log.
-
On the host running the Continuous Delivery for PE container, edit
/etc/puppetlabs/cd4pe/config/log4j.properties
to update the following settings:filter.threshold.level = trace appender.console.filter.threshold.level = TRACE logger.puppetEnterprise.level = trace
-
To force changes to be read, save your changes and restart the container:
systemctl restart docker-cd4pe
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles