mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
doc/mgr: update mgr modules' logging instructions
Signed-off-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
parent
25b99ddecb
commit
3809044b7c
@ -48,13 +48,58 @@ or older versions of Ceph.
|
||||
Logging
|
||||
-------
|
||||
|
||||
``MgrModule`` instances have a ``log`` property which is a logger instance that
|
||||
sends log messages into the Ceph logging layer where they will be recorded
|
||||
in the mgr daemon's log file.
|
||||
Logging in Ceph manager modules is done as in any other Python program. Just
|
||||
import the ``logging`` package and get a logger instance with the
|
||||
``logging.getLogger`` function.
|
||||
|
||||
Each module has a ``log_level`` option that specifies the current Python
|
||||
logging level of the module.
|
||||
To change or query the logging level of the module use the following Ceph
|
||||
commands::
|
||||
|
||||
ceph config get mgr mgr/<module_name>/log_level
|
||||
ceph config set mgr mgr/<module_name>/log_level <info|debug|critical|error|warning|>
|
||||
|
||||
The logging level used upon the module's start is determined by the current
|
||||
logging level of the mgr daemon, unless if the ``log_level`` option was
|
||||
previously set with the ``config set ...`` command. The mgr daemon logging
|
||||
level is mapped to the module python logging level as follows:
|
||||
|
||||
* <= 0 is CRITICAL
|
||||
* <= 1 is WARNING
|
||||
* <= 4 is INFO
|
||||
* <= +inf is DEBUG
|
||||
|
||||
We can unset the module log level and fallback to the mgr daemon logging level
|
||||
by running the following command::
|
||||
|
||||
ceph config set mgr mgr/<module_name>/log_level ''
|
||||
|
||||
By default, modules' logging messages are processed by the Ceph logging layer
|
||||
where they will be recorded in the mgr daemon's log file.
|
||||
But it's also possible to send a module's logging message to it's own file.
|
||||
|
||||
The module's log file will be located in the same directory as the mgr daemon's
|
||||
log file with the following name pattern::
|
||||
|
||||
<mgr_daemon_log_file_name>.<module_name>.log
|
||||
|
||||
To enable the file logging on a module use the following command::
|
||||
|
||||
ceph config set mgr mgr/<module_name>/log_to_file true
|
||||
|
||||
When the module's file logging is enabled, module's logging messages stop
|
||||
being written to the mgr daemon's log file and are only written to the
|
||||
module's log file.
|
||||
|
||||
It's also possible to check the status and disable the file logging with the
|
||||
following commands::
|
||||
|
||||
ceph config get mgr mgr/<module_name>/log_to_file
|
||||
ceph config set mgr mgr/<module_name>/log_to_file false
|
||||
|
||||
|
||||
|
||||
Use it the same way you would any other python logger. The python
|
||||
log levels debug, info, warn, err are mapped into the Ceph
|
||||
severities 20, 4, 1 and 0 respectively.
|
||||
|
||||
Exposing commands
|
||||
-----------------
|
||||
@ -348,20 +393,6 @@ implementation may change to serialize arguments and return
|
||||
values.
|
||||
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
||||
Use your module's ``log`` attribute as your logger. This is a logger
|
||||
configured to output via the ceph logging framework, to the local ceph-mgr
|
||||
log files.
|
||||
|
||||
Python log severities are mapped to ceph severities as follows:
|
||||
|
||||
* DEBUG is 20
|
||||
* INFO is 4
|
||||
* WARN is 1
|
||||
* ERR is 0
|
||||
|
||||
Shutting down cleanly
|
||||
---------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user