KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > util > log > util > DefaultErrorHandler


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8 package org.jivesoftware.util.log.util;
9
10 import org.jivesoftware.util.log.ErrorHandler;
11 import org.jivesoftware.util.log.LogEvent;
12
13 /**
14  * Handle unrecoverable errors that occur during logging by
15  * writing to standard error.
16  *
17  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
18  */

19 public class DefaultErrorHandler
20         implements ErrorHandler {
21     /**
22      * Log an unrecoverable error.
23      *
24      * @param message the error message
25      * @param throwable the exception associated with error (may be null)
26      * @param event the LogEvent that caused error, if any (may be null)
27      */

28     public void error(final String JavaDoc message,
29                       final Throwable JavaDoc throwable,
30                       final LogEvent event) {
31         System.err.println("Logging Error: " + message);
32         if (null != throwable) {
33             throwable.printStackTrace();
34         }
35     }
36 }
37
Popular Tags