[logback-user] slf4 with logback causes java.lang.OutOfMemoryError: Java heap space

Ceki Gulcu ceki at qos.ch
Thu Jul 30 20:32:33 CEST 2009

Mel T wrote:
> This memory problem is caused by the JUnit and task. 

I suppose you meant "by the Junit *Ant* task".

 > This implementation (1.7.0, don't know about more recent version) creates a
> ByteArrayOutputStream where all logs coming from the tests are sent to. All
> logs are accumulated in there and this buffer is freed after the test
> finishes.
> Some tests use DbUnit, which has an astronomic number of debug logs. 
> I ran YourKit profiler on that and this ByteArrayOutputStream grew to 1G at
> one point around which it caused the heap space memory error. 

Ideally, you would contact the Ant user list to report this
problem. The DBUnit folks should be notified as well. (Generating 1GB
of logs may not be reasonable.)

> When running with no logback.xml, the default behavior kicked in and all
> debugs ended up in memory. 
> Using slf4 simple binding, only INFO and up is displayed. So the DBUnit
> debug logs are not accumulating.

Makes sense.

> Using log4j binding without config file also seems to only show INFO and up.

Since log4j does not have default (valid) configuration, it just
complains that there is no config file and proceeds to drop all log

I am sorry about the time you spent/wasted on this issue. Thank you
for sharing the results of your investigation on this list.

> --
> Mel T.

Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the Logback-user mailing list