org.objectweb.easybeans.log
Class JDKConsoleHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.objectweb.easybeans.log.JDKConsoleHandler

public class JDKConsoleHandler
extends java.util.logging.Handler

Handler that display info message in System.out and error in System.err because JDK implementation prints all messages in System.err and in Eclipse, for example, INFO messages are in red !

Author:
Florent Benoit

Field Summary
private  java.io.Writer errOutputWriter
          Writer used for WARNING, SEVERE, FATAL.
private  java.io.Writer infoOutputWriter
          Writer used for traces INFO, FINE, FINEST, etc.
 
Constructor Summary
JDKConsoleHandler()
          Creates a new handler with two appender, System.out and System.err.
 
Method Summary
 void close()
          Close the handler by flushing all writers.
 void flush()
          Flush all the current writers (info and error).
private  void flush(java.io.Writer writer)
          Flush the given writer.
 void publish(java.util.logging.LogRecord logRecord)
          Prints the record on the correct writer.
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infoOutputWriter

private java.io.Writer infoOutputWriter
Writer used for traces INFO, FINE, FINEST, etc.


errOutputWriter

private java.io.Writer errOutputWriter
Writer used for WARNING, SEVERE, FATAL.

Constructor Detail

JDKConsoleHandler

public JDKConsoleHandler()
Creates a new handler with two appender, System.out and System.err.

Method Detail

publish

public void publish(java.util.logging.LogRecord logRecord)
Prints the record on the correct writer.

Specified by:
publish in class java.util.logging.Handler
Parameters:
logRecord - the given record with all info to log.

flush

private void flush(java.io.Writer writer)
Flush the given writer.

Parameters:
writer - the writer to flush.

flush

public void flush()
Flush all the current writers (info and error).

Specified by:
flush in class java.util.logging.Handler

close

public void close()
Close the handler by flushing all writers.

Specified by:
close in class java.util.logging.Handler