Skip to content

Commit

Permalink
[#1922] fixes: avoid possible NPE in play.Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
rrettig authored and xael-fry committed Feb 16, 2015
1 parent b590bde commit 01a0cf9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion framework/src/play/Logger.java
Expand Up @@ -675,14 +675,15 @@ static CallInfo getCallerInformations(int level) {
*/
public static class JuliToLog4jHandler extends Handler {

@Override
public void publish(LogRecord record) {
org.apache.log4j.Logger log4j = getTargetLogger(record.getLoggerName());
Priority priority = toLog4j(record.getLevel());
log4j.log(priority, toLog4jMessage(record), record.getThrown());
}

static org.apache.log4j.Logger getTargetLogger(String loggerName) {
return org.apache.log4j.Logger.getLogger(loggerName);
return loggerName != null ? org.apache.log4j.Logger.getLogger(loggerName) : org.apache.log4j.Logger.getRootLogger();
}

public static org.apache.log4j.Logger getTargetLogger(Class<?> clazz) {
Expand Down

0 comments on commit 01a0cf9

Please sign in to comment.