[logback-user] OOM on debug level with SLF4j + Logback

Joern Huxhorn jhuxhorn at googlemail.com
Mon Sep 6 17:51:50 CEST 2010


Hi Jeff,

On 06.09.2010, at 17:25, Jeff Jensen wrote:

> 
> On a whim I changed the log level from DEBUG to INFO and the OOMs stopped;
> this really surprised us.  A lot of logging was occurring so I then
> experimented with appenders, e.g. not using Lilith appender, but that had no
> effect.  Only reducing the level had an effect. 
> 

Nice to hear that Lilith wasn't the culprit ;)

> 
> Has anyone experienced this too?  Are their known issues or gotchas that we
> may be unknowingly doing with logging?  Any advice on how to find root
> cause?
> 

The only idea I have how this could happen would be the creation of a large amount of loggers with different names.
Loggers instances are kept in the LoggerFactory so if you have code somewhere that creates Loggers based on anything else than classname, this could be the reason.
For example, there could be some code that is creating Loggers using toString - which would be quite random in case of Objects that have no explicit toString().

You could check for this using LoggerContext.getLoggerList():

ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
if (loggerFactory instanceof LoggerContext) {
  LoggerContext loggerContext = (LoggerContext) loggerFactory;
  List<Logger> loggers=loggerContext.getLoggerList();
  // do something
}

I have no other idea right now.

Cheers,
Joern.


More information about the Logback-user mailing list