I am using JUL in my application. Normally, Netbeans opens an output tab that reads "Tomcat" and shows the logs I produce. It was working fine. But suddenly, I realise that my logs are not shown at all, only the System.out
get printed. Not even the higuest LOG.log(Level.SEVERE, "....
.
} catch(Exception e) {
System.out.println("This gets printed in Netbeans tab");
LOG.log(Level.SEVERE, "This doesnt");
}
I suspect it can be a library I included, which is messing with my logs. Is that possible at all? Can a librray change the way my logs are shown? How can I investigate this, since I am a bit lost?
Yes. The JUL to SLF4J Bridge can remove the console handler from the JUL root logger. Some libraries invoke
LogManager.reset
which can remove and close all handlers.Yes. Once the a log bridge is installed the JUL records are no longer formatted by the JUL formatters.
Modifying the logger tree requires permissions so you can install a SecurityManager with all permissions but then turn on debug tracing with -Djava.security.debug="access,stack" to determine the caller that is modifying the logger tree.
If that doesn't work you can use good ole'
System.out
to print the logger tree and the attached handlers before and after a library is loaded. Then start adding an removing libraries until you see the logger change.