Details
Description
The log methods in class LoggingFilter use the subsequent eventLevel instead of current
For example:
If the current eventLevel i= LogLevel.INFO the log method uses logger.warn to print the message (see source code for proof).
private void log(LogLevel eventLevel, String message) {
if (eventLevel == LogLevel.TRACE)
else if (eventLevel.getLevel() > LogLevel.INFO.getLevel())
{ logger.info(message); }else if (eventLevel.getLevel() > LogLevel.WARN.getLevel())
{ logger.warn(message); }else if (eventLevel.getLevel() > LogLevel.ERROR.getLevel())
{ logger.error(message); }}
Remedy:
Either replace the > operator by a >= operator in all three log methods or use a switch statement (see code below)
/**
- Log if the logger and the current event log level are compatible. We log
- a message and an exception.
- @param eventLevel the event log level as requested by the user
- @param message the message to log
- @param cause the exception cause to log
*/
private void log(LogLevel eventLevel, String message, Throwable cause)Unknown macro: { switch(eventLevel) { case TRACE: logger.trace(message, cause); break; case DEBUG: case INFO: logger.info(message, cause); break; case WARN: logger.warn(message, cause); break; case ERROR: logger.error(message, cause); break; } }
/**
- Log if the logger and the current event log level are compatible. We log
- a formated message and its parameters.
- @param eventLevel the event log level as requested by the user
- @param message the formated message to log
- @param param the parameter injected into the message
*/
private void log(LogLevel eventLevel, String message, Object param)Unknown macro: { switch(eventLevel) { case TRACE: logger.trace(message, param); break; case DEBUG: case INFO: logger.info(message, param); break; case WARN: logger.warn(message, param); break; case ERROR: logger.error(message, param); break; } }
/**
- Log if the logger and the current event log level are compatible. We log
- a simple message.
- @param eventLevel the event log level as requested by the user
- @param message the message to log
*/
private void log(LogLevel eventLevel, String message)Unknown macro: { switch(eventLevel) { case TRACE: logger.trace(message); break; case DEBUG: case INFO: logger.info(message); break; case WARN: logger.warn(message); break; case ERROR: logger.error(message); break; } }