Дерево страниц

Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 3 Следующий »

The basic idea of logging:

  1. The program checks the global logging level with regard to the logging level of a message.
  2. If the global logging level enables logging the message, the logging level of a specific logger is checked.
  3. If the logging level of the logger enables logging the message, the message is sent to the logging system.
  4. The logging system checks all active backends whether they are capable of the message output (applies filters).
  5. The message is sent to the backends for which the result of filtering was a success. In this case, the message is formatted for every backend according to its formatting rule.

Message filtering during the 1 and 2 stages does not take time. Filtering during the stage 4 takes a way much more time. Therefore, it is recommended to apply filtering only if it is crucial.

Logging configuration:

ContentDescription
 "Logging": {
 
        "Loggers": {

Contains the list of loggers for the various program components, where the key is a logger name, the value is a logging level. Logger separation is performed for fine-tuning messages to be logged:

  • Cachets - logging settings for the cached trees loading/unloading subsystem
  • InfoCollector - logging settings for the system information gathering subsystem
  • Integrity - logging settings for the data integrity checking/maintenance subsystem
  • Scan - logging settings for the folder scanning subsystem
  • Sender 

  • Dreamcatcher 
  • ProcMan 
  • IslerTManager 
  • IslerController 
  • IslerDocument 
  • IslerConnector 
  • StatementCollector 
  • Connection 
  • Collector 
  • EventConverter 
  • Statistics 
  • Iscp 
  • Object 
  • pop3 
  • Script 
  • nrpc 
  • Om3 
  • POP3 Parser 
  • imap4 
  • Automate 
  • ListenArea_capstack 
  • ListenArea_icq 
  • ListenArea_smtp 
  • ListenArea_pcap 
  • DB - data base logger
  • Devour - building xmlpipe2 files for indexer
  • Indexer - operations with the configuration file of searchd daemon: indexing, indexes and daemon files management
  • Root - root logger, responsible for reading DB records, indexes creating, archiving, indexes deleting
  • Stat - statistical data messages (various operations runtime) 

Possible logging levels (Severity):

  • trace - detailed logging (including messages with the levels debug, info and higher)
  • debug - debugging information output, usually for error diagnostics and communication with developers/tech support.
  • info - information messages, could be disabled on the stable system
  • warning
  • error
  • fatal - most important messages leading to system crash and failure.

 

Example:

From two values the strictest is selected, e.g. if GlobalLevel = warning,  Stat = info => effective value for Stat = warning (restricted by the global level)


 "Root": "debug"
Root logger, responsible for reading DB records, indexes creating, archiving, indexes deleting
  }, 
 
  "Core": {
Logging kernel general settings
      "DisableLogging": false
Capability to disable logging in the component. Disabling after the first 3 stages of the message transfer through the logging system, since these stages are performed outside of the logging system and are not controlled by this setting
   }, 
 
   "Backends": {
Backends list
       "DefaultDirectory": "/var/log/infowatch/", 
Default directory for logging to a file
       "ActiveBackends": [
Active backends list. The backends, that are on the list, are considered for logging
            "Console", 
Console output (if the process is not launched as daemon, otherwise logs will be saved to /dev/null). The fastest backend
            "Syslog", 
System log output (/var/log/messages). The slowest backend
            "File"
Specified text file output (directory for a file to be created is specified in the parameter DefaultDirectory). Relatively slow backend
       ], 
 
       "Descriptions": {
Possible backend descriptions list, where the key is a backend name, the value is a backend description object. This list only describes backends. To make a backend active, add it to the list ActiveBackends
           "Syslog": {
System log output description
               "Destination": "Syslog", 
Backend type
               "Asynchronous": false,
Asynchronous backend or not. The asynchronous mode implies the message will be recorded after the message is processed by the logging system (the message will be enqueued and sent to console/syslog/file at some time). This means, if the System hangs up immediately after the message is processed by the logging system, there is a high possibility that the message to never be logged. The pro of the asynchronous mode is faster message processing (the main code of the program spends less time processing messages). It makes sense to set true, when it is necessary to have intensive logging, and the program performance does not raise questions. Otherwise, false should be set.
           "Format": "%LineID% (%ProcessID%:%ThreadID%) 
[%Severity%] : <%Channel%> %Message%"

Message formatting rules. Key words for formatting and filtering:

  • Severity - logging level
  • LineID - line in a code, where the message was called
  • ProcessID - PID
  • ThreadID - TID
  • Channel - logger name, through which the message was sent
  • Message - message text
  • TimeStamp - message generation time stamp
               "Console": {
Console output description
                    "AutoFlush": true, 
Screen output or awaiting in the buffer. The false parameter gives the same result as Asynchronous=true (see above)
                    "Destination": "Console", 
Backend type
                     "Asynchronous": false, 
Asynchronous backend or not
                     "Format": "%LineID% %TimeStamp% (%ProcessID%:%ThreadID%) 
[%Severity%] : <%Channel%> %Message%"
Message formating rules
                }, 
 
                "File": {
Specified text file output description
                     "Format": "%LineID% %TimeStamp% (%ProcessID%:%ThreadID%) 
[%Severity%] : <%Channel%> %Message%", 
Message formating rules
                     "Destination": "TextFile", 
Backend type
                     "FileName": "adlibitum.log", 
File name, where log will be written in
                    "AutoFlush": true, 
Screen output or awaiting in the buffer. The false parameter gives the same result as Asynchronous=true. Setting rules are the same (but invertible).
                    "Asynchronous": false, 
Asynchronous backend or not
                    "Append": true
Add message to an old file or create a new file at the program startup
                }
 
            }
 
        }, 
 
        "SuppressExceptions": false, 
Suppress exceptions in the logging mechanism
        "GlobalLevel": "warning"
Global logging level. Recommended value when implementing – error. This level enables logging messages with the level error or higher (fatal). 
Normal operation value and by default - warning, i.e. only errors and warnings are written in logs. It is not recommended to use the trace value without special purpose
  • Нет меток