-
Feature Request
-
Resolution: Done
-
Blocker
-
3.2.0.Beta1
-
None
-
Compatibility/Configuration, User Experience
When you enable logging of org.hibernate.SQL the log is not send to the log4j loggers/appenders.
The reason for that is a null pointer exception in:
Class:
Log4j2Logger
Method:
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) {
Line:
54
Log4j2Logger.java
@Override protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { final org.apache.logging.log4j.Level translatedLevel = Log4j2Logger.translate(level); if (this.logger.isEnabled(translatedLevel)) { try { this.logger.log(null, loggerClassName, translatedLevel, parameters == null || parameters.length == 0 ? this.messageFactory.newMessage(message) : this.messageFactory.newMessage(String.valueOf(message), parameters), thrown); } catch (Throwable ignored) { } } }
This this.logger.log call is the one causing NPE which is ignored .. because of the surrounding catch.
If you change the call to something like :
Example (params are not passed but you can pas them as well )
this.logger.log(translatedLevel,this.messageFactory.newMessage(String.valueOf(message), thrown)
As an example you will see its working.
- blocks
-
ISPN-3076 Infinispan should enable use of log4j2
- Closed