Jenkins

How to View the Jenkins Logs

Jenkins is one of the most influential and popular free and open-source CD/CD automation servers for developers.

Apart from the plethora of tools and plugins which are supported by Jenkins, it provides an incredibly powerful logger that keeps track of almost every operation on the server.

Jenkins allows us to view and examine the logs for every build including the error messages, script outputs, command execution processes, and more.

As developers, you may encounter some instances where you need to review the system logs and examine what operations are executed and where lies the potential problems.

In this tutorial, we will learn the various ways to access our system’s Jenkins logs. In addition, this tutorial demonstrates how to view the logs on a Linux system based on Debian 11.

NOTE: By default, running the Jenkins.war file manually using the java -jar command outputs the log information to the standard output. Hence, the log may not be available in the location of the stored log.

Where Are Logs Stored in Jenkins?

The easiest way to access the Jenkins logs from the terminal is simply locating where the files are stored in the filesystem.

It is good to keep in mind that the location of the Jenkins logs may vary depending on the target system and the configuration.

However, by default, the following are the locations of the Jenkins logs in various systems:

  1. Linux Systems – /var/log
  2. Windows – %JENKINS_HOME%. The JENKINS_HOME is the location where Jenkins is installed on the target system.
  3. MacOS – /var/log/jenkins/

Jenkins also allows us to customize the location of the log directory by editing the Jenkins configuration file.

On the Linux systems, you can find the Jenkins configuration file in the following directory:

/etc/default/Jenkins

On the Red-Hat-based systems, the Jenkins configuration file is located in the following:

/etc/sysconfig/Jenkins

On macOS, you can find the Jenkins configuration file in the following:

/Library/Preferences/org.jenkins-ci.plist

On Windows, the Jenkins configuration file is located in the following:

%JENKINS_HOME%/jenkins.xml

Method 1: How to View the Jenkins Logs

The first method that you can use to view a Jenkins server’s logs is the cat command followed by the log file.

For example, to view the Jenkins logs in Linux, we can use the following command:

sudo cat /var/log/jenkins/jenkins.log | less

You will find two log files on Windows:

  • Jenkins.out – This holds the general log information on the Jenkins server.
  • Jenkins.err – This log file stores the error logs from the Jenkins server.

Method 2: How to View the Jenkins Logs

We can also view the logs on a Jenkins server from the Jenkins dashboard.

Start by logging into your Jenkins web interface -> Manage Jenkins -> System Log.

Select “All Jenkins Logs” to view the system logs on the server.

You will see the log information on the server as shown in the following sample output:

To view the log as an RSS feed, you can navigate to your Jenkin_url/manage/log/rss.

Example:

http://localhost:8080/manage/log/rss

Conclusion

This tutorial taught you how to view the Jenkins logs on various systems. You can explore our other tutorials to learn how you can configure multiple Jenkins log levels.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list