Skip to main content

How to use Java Loggin in a war?

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2006-12-09

I can't figure out how to use a sepparat log file in a WAR or EAR to log only application specific messages into a application specific log file.
In my JSF Application I use a code like this to get a Logger instance:

 private static  Logger jlog = null;<span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>

final ClassLoader cl = WorkitemBean.class.getClassLoader();

        cl.getResourceAsStream(&quot;;));<span class="Apple-tab-span" style="white-space:pre">  </span>

But it seams that the 'readConfiguration()' method resets the whole logging for my glassfish instance :-( So everything goes into the log file defined in my file.
The property file looks like this



# Console only INFO
java.util.logging.ConsoleHandler.level = INFO
# Log file settings
java.util.logging.FileHandler.pattern =test.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

Can anybody point me to an example how to write application specific log messages into a separat log file and leave all other messages form the other applications and the glassfish server into the console / server.log

Thanks for any help