The Daily WTF
For years, Carla‘s company had a Java application with a memory leak. No one had the time, energy, or budget to actually do anything about the leak, so they “fixed” it by just forcing a nightly reboot.
When Carla asked about the nightly reboot, the elders who had been around for awhile simply said, “there were some issues we couldn’t track down.”
Carla was assigned a task to go track down some of those untrackable issues. The first thing she discovered was that when she changed the logging level from its production settings to “DEBUG” mode, the application crashed in minutes instead of days. That piece of information sent Carla looking at the logging code to see what was happening.
private static StringWriter logWriter; static { logWriter = new StringWriter(); Layout layout = new PatternLayout(); WriterAppender writerAppender = new WriterAppender(layout, logWriter); writerAppender.setThreshold(Level.DEBUG); writerAppender.activateOptions(); Logger.getRootLogger().addAppender(writerAppender); }
As one might gather
To read the full article click on the 'post' link at the top.