Commands.page Logo

How to Change Log Level to Debug in Ubuntu

This article provides a concise guide on enabling debug logging within the Ubuntu operating system. It outlines the specific commands and configuration adjustments required to increase log verbosity for effective system troubleshooting and error analysis.

To immediately change the systemd manager log level to debug, run the following command in your terminal:

sudo systemctl log-level debug

This command takes effect instantly without requiring a reboot. However, this setting primarily applies to the systemd daemon itself. For persistent system-wide debug logging via the journal, you must modify the configuration file. Open /etc/systemd/journald.conf using a text editor like nano:

sudo nano /etc/systemd/journald.conf

Locate the line starting with #LogLevel= and change it to:

LogLevel=debug

Remove the hash symbol (#) to uncomment the line. Save the file and restart the systemd journal service to apply the changes:

sudo systemctl restart systemd-journald

To view the detailed debug logs after enabling these settings, use the journalctl command:

journalctl -p debug

Remember to revert these changes after troubleshooting, as debug logging can consume significant disk space and impact system performance.