No longer used since :blogref:`20160712`.
Provides the default logging configuration interface shipped with Lino applications for out-of-the-box usage in typical situations.
In order to disable Lino's system, you can either set
LOGGING_CONFIG to your own value, you configure logging
yourself manually before Lino starts. For example by writing at the
begnning of your
import logging logging.basicConfig(level=logging.INFO)
Or when you want to log things that happen before Django calls
lino.utils.log.configure(), then you must also manually
A simple common example:
LOGGING = dict(filename='/var/log/lino/system.log',level='INFO')
Another example using
... SITE = Site(globals()) ... LOGGING = dict( filename=join(SITE.project_dir, 'log', 'system.log'), level='DEBUG')
The following example to use date-based log files is not recommended since the filename is computed once per process, causing a long-running server process to log to an old file even though a newer file might have been created by another process:
import datetime filename = datetime.date.today().strftime('/var/log/lino/%Y-%m-%d.log') LOGGING = dict(filename=filename,level='DEBUG',rotate=False)
Django applications cannot use Python-based Logfile rotation since
with Django it is possible to have several processes using the same
settings.py file. That would sooner or later cause problems
when they all try to rotate at the same time.
On Linux systems, Lino uses WatchedFileHandler so that system administrators can install system-wide log rotation with logrotate.
Yes, we read the mod_wsgi documentation saying "code should ideally not be making assumptions about the environment it is executing in, eg., whether it is running in an interactive mode, by asking whether standard output is a tty. In other words, calling 'isatty()' will cause a similar error with mod_wsgi. If such code is a library module, the code should be providing a way to specifically flag that it is a non interactive application and not use magic to determine whether that is the case or not.". Any comments are welcome.
See also docs/tickets/15
(This module's source code is available here.)
logfile -- the full path of the lino system.log file. If absent or None, there will be no system.log file.
level -- the overall verbosity level for both console and logfile.
mode -- the opening mode for the logfile
encoding -- the encoding for the logfile
tty -- whether to install a default logger to the terminal
logger_names -- A list or tuple of names of loggers to configure. If this is a string, Lino converts it to a list (expecting it to be a space-separated list of names). Default value is 'lino'.
If there is a logfile, then console messages will never be more verbose than INFO because too many messages on the screen are disturbing, and if the level is DEBUG you will better analyze them in the logfile.
Automatically adds an AdminEmailHandler with level ERROR to all specified loggers and to the 'django' logger (even if 'django' is not specified in loggers). Because that's rather necessary on a production server with