Skip to Content

How to Configure File Logging in Odoo: Step-by-Step Guide

November 6, 2026 by

When an ERP system runs on a production server, logs are the most important source of insight into what is happening inside the application. They help you quickly find the cause of an error, detect unauthorized access attempts and assess performance. By default, Odoo writes messages to the standard error stream (stderr), which is not enough in a production environment. In this guide, we show you how to configure file logging in Odoo, how to choose the right log levels and how to take care of log file rotation.

Want to see how Odoo works before you deploy it in your company? Try the system for free.

Try Odoo for free

Why should you write Odoo logs to a file?

File logging gives you a persistent record of events that survives a service restart and the closing of a terminal session. This allows you to:

  • analyze errors that occurred in the past,
  • monitor slow queries and performance issues,
  • audit administrative actions and login attempts,
  • forward logs to monitoring tools such as Grafana Loki, ELK or Graylog.

Basic configuration: the logfile parameter

File logging is controlled by the logfile option. You can set it in two ways: in the configuration file or as a command-line parameter.

Configuration in the odoo.conf file

Open the configuration file (usually /etc/odoo/odoo.conf) and add the following entry in the [options] section:

[options]
logfile = /var/log/odoo/odoo-server.log

Next, create a directory for the logs and grant permissions to the user that Odoo runs as:

sudo mkdir -p /var/log/odoo
sudo chown odoo:odoo /var/log/odoo
sudo chmod 750 /var/log/odoo

After making the changes, restart the service:

sudo systemctl restart odoo

To make sure the configuration works, check that the file has been created and that new entries are appearing in it:

ls -l /var/log/odoo/
tail -n 20 /var/log/odoo/odoo-server.log

Keep in mind that once logfile is set, Odoo messages no longer go to stderr, so you will not see them in journalctl. You can still find information about service startup errors with the systemctl status odoo command.

Configuration from the command line

When starting the server manually, you can specify the log file with a parameter:

./odoo-bin -c /etc/odoo/odoo.conf --logfile=/var/log/odoo/odoo-server.log

A parameter passed on the command line takes precedence over the value in the configuration file, which is convenient during testing.

Log levels in Odoo

You control the level of log detail with the log_level option. Available levels include critical, error, warn, info, debug and several predefined profiles, such as debug_sql (SQL queries), debug_rpc (RPC requests) and debug_rpc_answer (RPC requests and responses).

log_level = info

In production, the info or warn level is recommended. Debug levels generate huge amounts of data, can put a load on the disk and may contain sensitive information, so enable them only for the duration of troubleshooting.

Each log line contains the date, process ID (PID), level, database name, logger name and message text. This makes it easy to filter entries for a specific database or module.

Fine-tuning the level for selected modules

The log_handler option lets you set different levels for individual loggers:

log_handler = :INFO,odoo.addons.sale:DEBUG,odoo.sql_db:WARNING

This way, you can trace only the module you are interested in in detail, without flooding the file with unnecessary messages. The :INFO entry sets the default level for all other loggers.

Writing logs to the database

Odoo can also write logs to the ir_logging table in the database, using the log_db and log_db_level options. This is a complementary solution, not a replacement for the log file, because it increases the database load, so use it with care.

Logging to syslog

An alternative to a file is sending logs to a system service. Simply set:

syslog = True

This works well when logs are collected centrally by system mechanisms such as journald or rsyslog. Keep in mind that when the syslog option is enabled, it takes precedence, and Odoo does not write logs to the file specified in logfile. So choose one of these methods.

Log rotation with logrotate

Without rotation, the log file will grow indefinitely and may fill up the disk. On Linux servers, the simplest solution is the logrotate tool. Create the /etc/logrotate.d/odoo file:

/var/log/odoo/*.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
    create 640 odoo odoo
}

This configuration keeps 14 days of logs, compresses older files and creates a new file with the correct permissions. On Linux, Odoo uses a mechanism that detects when the file has been moved and reopens it on its own, so restarting the service after rotation is usually not necessary. If new entries in your environment still go to the old file, you can replace create with the copytruncate option, keeping in mind that in rare cases it may cause the loss of the last few lines.

Odoo also has built-in rotation, enabled with the logrotate = True option (disabled by default). It rotates logs daily and keeps up to 30 files. However, many administrators prefer system tools, which give more control over compression and retention time. Do not combine both solutions at the same time.

Configuring logging, rotation and monitoring across multiple environments can be time-consuming and error-prone. If you would rather leave it to specialists, contact our team.

Contact us

Logging with multiple worker processes

If you run Odoo with multiple workers, all processes write to the same log file. In that case, pay attention to the process IDs (PID) in the log lines, which make it easier to trace events. You can read more about scaling in the article How to Configure Odoo with Multiple Workers?.

Try Odoo for free

Analyzing and browsing logs

For a live view, use the following command:

tail -f /var/log/odoo/odoo-server.log

grep is useful for finding errors. Matching the level as a separate word reduces the number of false positives:

grep -E ' (ERROR|CRITICAL) ' /var/log/odoo/odoo-server.log

To search through older, compressed files, use zgrep instead of grep.

Regular log analysis helps you detect slow queries and bottlenecks. If you want to speed up your system, check out the article How to Optimize Odoo Performance? Proven Methods.

Best practices for file logging

  • Restrict permissions – logs may contain sensitive data, so only the administrator and the service user should have access.
  • Use the info level in production – enable debug mode only temporarily.
  • Configure rotation – protect yourself from running out of disk space.
  • Monitor disk space – set up alerts for when free space drops below a threshold.
  • Secure database management – see Odoo Database Manager: How It Works and How to Secure It.
  • Keep backups up to date – read how to set up automatic backups in Odoo.

Most common issues

No log file after restart

The most common cause is missing permissions to the directory or an incorrect path. Check the directory owner and the service status with the systemctl status odoo command.

The log file is empty

Make sure Odoo is using the correct configuration file and that the logfile parameter is not commented out. Also check whether the syslog option is active, as it takes precedence over writing to a file.

New entries do not appear in the file after rotation

Check that the new file is owned by odoo and that the logrotate configuration includes the create 640 odoo odoo option. If the problem persists, use copytruncate or restart the service.

The file size grows too quickly

Lower the log level to warn or info, check that no debug profiles have been left enabled, and introduce daily rotation.

FAQ – Frequently asked questions

Where does Odoo write logs by default?

If you do not set the logfile parameter, Odoo writes logs to the standard error stream (stderr). In installations from system packages, the configuration file usually already points to a file in the /var/log/odoo/ directory.

Does changing the logging configuration require an Odoo restart?

Yes. Changes in the odoo.conf file, such as logfile or log_level, are loaded at startup, so you need to restart the Odoo service after editing.

Which log level should I choose in production?

The best choice is info, which strikes a balance between detail and performance. The warn level works well when you want to keep logs as small as possible. Enable debugging only for the duration of troubleshooting.

What does Odoo logging look like in Docker?

In containers, logfile is usually not set. Odoo then writes logs to stderr, and Docker or the orchestration system takes care of collecting them. You can view them with the docker logs -f container_name command.

Summary

Configuring file logging in Odoo comes down to setting the logfile parameter, choosing the right log_level and implementing log rotation. These simple steps significantly simplify troubleshooting, improve security and help you maintain a stable production environment.

Need support with implementing, optimizing or maintaining Odoo? Contact KK Innovations – we will help you configure the system exactly to your company's needs.

Contact us