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

Mel T machintruc at gmail.com
Thu Jul 30 20:16:41 CEST 2009



This memory problem is caused by the JUnit and 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. 

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.

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

--
Mel T.


Mel T wrote:
> 
> When running ANT tasks in eclipse, it seems that the log messages are
> accumulated in memory before they get dumped in the console. Therefore,
> when running with the default config, it causes all debug logs to be in
> memory (and these failing tests use hibernate, spring, and many other
> libs). 
> 
> It is unclear to me though why the problem occurs with logback and not
> with sl4j-simple nor log4j.
> 



-- 
View this message in context: http://www.nabble.com/slf4-with-logback-causes-java.lang.OutOfMemoryError%3A-Java-heap-space-tp24720872p24743922.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list