-
Notifications
You must be signed in to change notification settings - Fork 9
Logger
A logger is an object you will use to log messages. It is associated with three parameters :
- a UTI-style identifier (for example project.feature1.loggerName)
- a Threshold level, below which messages will be ignored
- a list of appenders, to which messages will be sent
When you register a logger to the factory, either using a configuration dictionary or a runtime-defined, you can get this logger by requesting it by its UTI identifier. You will then get a "real" logger, that will live its life on its own.
If you request a logger to the factory with a UTI that does not exist, the factory will generate a logger based on the closest one (see the logger factory page for more details on how the closest logger is found). This closest logger will be the parent logger of the generated logger.
The generated logger will use the same parameter as its parent, the only difference being its UTI.
If you change a setting of the parent logger, this change will also apply to the generated logger. For example, if you change the threshold level of the parent, or if you add a new appender to the parent, the generated logger will also use the new values.
if you change a setting of the generated logger, the relationship with the parent is broken. Changes to the settings of the former parent logger will no longer affect generated logger.
- On a synchronous logger, messages will be sent to all appenders before returning from the logging method.
- On an asynchronous logger, the logging method will return immediately. Messages will be sent to appenders on a background, low priority thread. There is no guaranty on how long it will take for the message to be logged : it will depend on the load of your machine.
You can mix synchronous and asynchronous loggers. The order of messages sent to loggers of the same type are guaranteed, but this is not true accros loggers types. For exemple, if you send a message to an asynchronous logger, and right after another message to a synchronous logger, the second message might be logged before the first one.
Loggers are synchronous by default.