Installation | Maintenance | Beyond Lino

About logging

This document explains everything you need to know about logging for Lino applications.

We presume that you have read the Django’s doc about Logging.

The Lino application log


When a Lino process starts up and sees a subdirectory named log in the project directory, then it automatically starts logging.

The main logger file


The name of Lino’s main logger file Default value is lino.log. Until 20160729 it was system.log.

Lino logging configuration

Some settings influence logging:

Setting the log level via the environment


If an environment variable LINO_LOGLEVEL is set, then it should contain the log level to use for both console and file handlers. It should be one of INFO, DEBUG etc.

Configuring logrotate

To activate logging to a file, you simply add a symbolic link named log which points to the actual location:

$ sudo mkdir -p /var/log/lino/
$ sudo chown :www-data /var/log/lino/
$ sudo chmod g+ws /var/log/lino/
$ sudo mkdir /var/log/lino/prj1/
$ cd ~/mypy/prj1/
$ ln -s /var/log/lino/prj1/ log/

We recommend a file /etc/logrotate.d/lino with something like:

/path/to/lino_sites/prod/log/lino.log {
        rotate 156
        create 660 root www-data
        su root www-data

After changes in the config you can tell logrotate to force them:

$ sudo logrotate -f /etc/logrotate.d/lino

Logging all bash commands to syslog

Add the following to your system-wide /etc/bash.bashrc:

# copied from
function log2syslog
   declare COMMAND
   COMMAND=$(fc -ln -0)
   logger -p local1.notice -t bash -i -- "${USER}:${COMMAND}"
trap log2syslog DEBUG