View Javadoc
1 /* 2 Bloof - visualize the evolution of your software project 3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de> 4 http://bloof.sf.net/ 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along with 15 this program; if not, write to the Free Software Foundation, Inc., 16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 $RCSfile: ConsoleOutErrHandler.java,v $ 19 Created on $Date: 2003/06/12 11:15:59 $ 20 */ 21 package net.sf.bloof.util.logging; 22 23 import java.util.logging.ConsoleHandler; 24 import java.util.logging.Handler; 25 import java.util.logging.Level; 26 import java.util.logging.LogRecord; 27 28 /*** 29 * Customized console logging handler. 30 * <p> 31 * The <tt>ConsoleOutErrHandler</tt> writes log messages 32 * of severity <tt>WARNING</tt> and higher to the <tt>System.err</tt> 33 * stream, and all other log messages to <tt>System.out</tt>. 34 * It uses a {@link LogFormatter} to format the records. 35 * 36 * @author Richard Cyganiak <rcyg@gmx.de> 37 * @version $Id: ConsoleOutErrHandler.java,v 1.6 2003/06/12 11:15:59 pekacki Exp $ 38 */ 39 public class ConsoleOutErrHandler extends Handler { 40 41 /*** 42 * Constructor for ConsoleOutErrHandler. 43 */ 44 public ConsoleOutErrHandler() { 45 super(); 46 } 47 48 /*** 49 * @see java.util.logging.Handler#close( ) 50 */ 51 public void close() throws SecurityException { 52 mErrHandler.close(); 53 mOutHandler.close(); 54 } 55 56 /*** 57 * @see java.util.logging.Handler#flush( ) 58 */ 59 public void flush() { 60 mErrHandler.flush(); 61 mOutHandler.flush(); 62 } 63 64 /*** 65 * @see java.util.logging.Handler#publish( LogRecord ) 66 * @param aRecord a log record 67 */ 68 public void publish(LogRecord aRecord) { 69 if (aRecord.getLevel().intValue() >= Level.WARNING.intValue()) { 70 mErrHandler.publish(aRecord); 71 } else { 72 mOutHandler.publish(aRecord); 73 } 74 } 75 76 private Handler mErrHandler = new ConsoleHandler(); 77 private Handler mOutHandler = new ConsoleOutHandler(); 78 }

This page was automatically generated by Maven