Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo - log archiving?

In older versions log archiving was on default and it would archive (mv older log to different log file) daily and kept archives for a week or so. Now on Odoo version 8, it puts everything on one log file and after some time it grows very big. It even takes some time to load that file. Is there a way to get old functionality in some way?

I have these lines in Odoo configuration file:

logfile = home/myuser/var/log/openerp/openerp-server.log
logrotate = True ;it seems to not do anything or I dont see what it does.

This is what I found for logging about Odoo configuration file (only for v7, so don't know how much it is relevant for v8):

# file where the server log will be stored
logfile = None

# do not rotate the logfile
logrotate = True

# Send the log to the syslog server
syslog = False

# setup a handler at LEVEL for a given PREFIX. An empty PREFIX indicates the root logger. This option can be repeated. Example: "openerp.orm:DEBUG" or "werkzeug:CRITICAL" (default: ":INFO")
log_handler = [':INFO']

# specify the level of the logging. Accepted values: info, debug_rpc, warn, test, critical, debug_sql, error, debug, debug_rpc_answer, notset
log_level = info
like image 551
Andrius Avatar asked Sep 19 '14 07:09

Andrius


2 Answers

It seems logrotate parameter works how I needed. At first I didn't notice it, maybe not whole 24h were not passed yet or (some time needed to archive log). But now I see it archives logs daily.

like image 53
Andrius Avatar answered Sep 19 '22 17:09

Andrius


Note that since Odoo 13, logrotate is no longer handled in Odoo itself.

Source: https://github.com/odoo/odoo/pull/29073

You have to setup another log rotation depending on your system.

On linux, one way to do it is by using logrotate, here is a script (for distributions based on apt, but should be easy to adapt)

https://github.com/ventor-tech/odoo-install-script/blob/main/logrotate.sh

like image 29
David V. Avatar answered Sep 22 '22 17:09

David V.