Messages are logged as follows:
- If using the Log4cxx macros(e.g.
LOG4CXX_DEBUG
), the macro must first be enabled. If the macro is not enabled(for example by setting the LOG4CXX_THRESHOLD
macro), then the log message is not compiled in and the line of code becomes a no-op.
- The logger level is checked to see if the request level is enabled. If it is, the message is then sent to the logger.
- The logger creates a new message and gives it to all of its appenders.
- Each appender checks the logging event's level is greater or equal to the appender's threshold level.
- Each appender checks its filters to see if the message should be logged.
Filters can perform the following actions:
- Accept the message: This message will immediately be logged without consulting any remaining filters
- Reject the message: This message will immediately be rejected without consulting any remaining filters
- Neutral: This filter neither rejects nor accepts the message, it will be passed on to the next filter in the chain
If a filter accepts the message, the message will be logged. If no filter rejects the message, the message will be logged.
The following flow diagram shows how messages flow through the system: