Setup
I am currently running a Jenkins instance on an Ubuntu 14.04 desktop machine. I have installed Jenkins via WAR distribution and am running Jenkins as a service on the host machine.
Issue
I am trying to access the jenkins.log file described here in the logging documentation on the Jenkins wiki. The purpose of accessing this file is to be sure we have a log to use in the event that Jenkins web UI is unavailable and there is an issue with Jenkins.
I've taken a look in /var/log/jenkins/ as the documentation suggests, however the only file in that folder is a config file.
Also, per the documentation, I have double checked the /etc/default/jenkins as well as the /etc/sysconfig/jenkins directories. Each one of these two directories does not exist on my machine.
I have also tried searching from command line using the 'find' command, as well as searching my system using the Ubuntu file explorer. Each of these approaches yielded no jenkins.log file.
Questions
- Am I correct in my understanding that Jenkins system logs are output
to the jenkins.log file?
- Where might the jenkins.log file be located on my machine?
- Is this the best approach in troubleshooting issues with Jenkins when the web UI is inaccessible?
- Am I correct in my understanding that Jenkins system logs are output to the jenkins.log file?
- Yes you are rigth. Internal engines, plugins, etc saves its logs in jenkins log file
- Where might the jenkins.log file be located on my machine?
- What is your command line which is executed as service in your machine?
- Is this the best approach in troubleshooting issues with Jenkins when the web UI is inaccessible?
- Yes you have the jenkins log file or a web alternative : https://your.jenkins.com/log/all but jenkins.log has more information
Steps to find your jenkins log path
locate jenkins service file :
/etc/default/jenkins: location for most of the Linux distributions.
/etc/sysconfig/jenkins: location for RedHat/CentOS distribution.
Open it and probably you will see :
NAME=jenkins
JENKINS_LOG=/var/log/$NAME/$NAME.log
So your file /var/log/jenkins/jenkins.log must be exist. If not like you said, try to add this line
Jenkins does not write to any file, so there is no jenkins.log
by default, instead it writes to the standard output.
So here is something we used in the init.d
file:
JENKINS_WAR=/path/to/jenkins/war/jenkins.war
JENKINS_LOG=/path/to/jenkins/log/jenkins.log
JAVA_HOME=/path/to/java/home
STARTUP="$JAVA_HOME/bin/java -Xms4096m -Xmx8192m -Dhudson.model.DirectoryBrowserSupport.CSP= -jar $JENKINS_WAR > $JENKINS_LOG 2>&1 &"
Also as suggested in the doc, you can use hook script to make it rotated.
You might also be interested in Audit Trail Plugin.