Logging settings (debug.conf)
All COREmanager-based products have a common logging system. All logs are written to the /var directory. When the maximum size is reached (100MB by default), the contents of the log are moved to the /var/logs directory and packed into an archive. A suffix is added to the filename - date and time of creation, and a sequential number (in case the log is moved more than once per second). The original file is truncated, and the first line of the file contains the name of the newly created archive.
COREmanager allows you to flexibly customize logging details. All settings are written to the /etc/debug.conf file. It can contain comments (everything after the # symbol), global settings (starting with the SET prefix), and detailed settings for individual modules.
The global settings include:
max_log_size — the maximum size to which a log file can grow before the control panel rotates it to /var/logs
color — use/do not use colored logs (possible values are on/off, the default value is on)
storage — possible values:
- file (add into the log file)
- console (send to stdout)
Examples:
SET color=off # disable coloured logs
SET mgrctl.max_log_size=1048576 # set the maximum log size for /var/mgrctl.log to 1 MB
Specification format:
<log name>[.<module name>] <logging level> [additional conditions]
a log name — file name in the /var directory. As a rule, it matches the name of the binary file that writes this file.
a module name — different components of the libmgr and libispapi libraries have different internal names. E.g., for the integration of a control panel with external services it can be useful to set the maximum logging level for the rpc module;
a logging level — a whole number from 1 (notes) to 9 (maximum details);
additional conditions — increase the logging level for certain requests. E.g. you can set it only for the requests sent from a certain user or certain IP address. Conditions can be set only for control panel logs. Possible values: realuser, user, level, ip, action, id, displayname, realdisplayname.
Example:
* 6 # set the loggingl level to 6 for all modules
mgrctl.* 5 # set the logging level to 5 for mgrctl.log
core.* 9 ip=192.168.1.1 # set the logging level to 9 for core.log only for the requests from 192.168.1.1
core.* 9 user~test # set the logging level to 9 for core.log only for the requests from the users which name contains test
If you have created several competitive rules, the rules that contain a module name have a larger priority than general rules. If you have created several rules for a certain module, the rule with the maximum details will be applied.
The system reads the logging settings when starting the application. You can make the control panel re-read the settings by sending HUP.
Logging levels:
# 1 - notes;
# 2 - fatal errors;
# 3 - errors;
# 4 - warnings;
# 5 - information about requests;
# 6 - extended information;
# 7 - remote service notifications;
# 8 - code tracing;
# 9 - debugging information.