Getting Jenkins to log on Ubuntu/Debian


If you install Jenkins natively on Ubuntu or Debian you may find that logging is not working. Logs should be saved to /var/log/jenkins/jenkins.log
Steps to get it working. Edit the service:

sudo vi /etc/systemd/system/multi-user.target.wants/jenkins.service

And uncomment this line (remove the #):

Environment="JENKINS_LOG=%L/jenkins/jenkins.log"

Then reload systemd:

sudo systemctl daemon-reload

Then restart Jenkins:

sudo service jenkins restart

Then you can view the logs:

tail -F /var/log/jenkins/jenkins.log