Friday, 24 August 2007

OC4J 10.1.3 j2ee-logging.xml console handler example

A note for myself , as I was trying to find an example on this:


level='FINEST' />


<logger name="simplelogging" level="FINEST" useparenthandlers="false">
<handler name="console-handler">

Java Code

public class LoggingTest extends HttpServlet
private static Logger logger =

Date d = new Date();
String s = d.toString();
logger.fine("pas simple logging test the current time is " + s);
// log levels
logger.log(Level.SEVERE,"pas simple logging test SEVERE!");
logger.log(Level.WARNING,"pas simple logging test WARNING!");
logger.log(Level.INFO,"pas simple logging test INFO!");
logger.log(Level.CONFIG,"pas simple logging test CONFIG!");
logger.log(Level.FINE,"pas simple logging test FINE!");
logger.log(Level.FINER,"pas simple logging test FINER!");
logger.log(Level.FINEST,"pas simple logging test FINEST!");


Output Location

The output using a console handler will go to the opmn log file for the container being used.



1 comment:

buttso said...

Pasmanus, coincidentally I've written up a few examples of using Java logging and Log4J with OC4J recently and discuss how to direct the output into the Oracle Java Diagnostics Logging (OJDL) service we have, and then viewing the log entries using the LogView in ASC.