com.sun.sgs.impl.sharedutil.logging
Class ExceptionFilter

java.lang.Object
  extended by com.sun.sgs.impl.sharedutil.logging.ExceptionFilter
All Implemented Interfaces:
Filter

public class ExceptionFilter
extends Object
implements Filter

Defines a logging Filter that logs exceptions at a different logging level from other logging. This filter selects log records that contain an exception of a specified type, and otherwise requires the record to have a particular logging level.

This class recognizes the following LogManager configuration properties:

Property: "com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.exception"
Default: java.lang.Throwable
Specifies the exception class for which log records containing an exception of that type should be logged regardless of the logging level. The value should be the fully qualified name of the exception class. All exceptions of the specified class or subclasses of that class will be considered.

Property: "com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.level"
Default: INFO
Specifies the logging level that is required for log records that do not contain an exception of the type specified by "com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.exception".

For example, to use this class to log records to the console that throw TransactionAbortedException at FINEST and all other messages at WARNING, put the following text in the logging configuration file:

   .level=FINEST
   handlers=java.util.logging.ConsoleHandler
   java.util.logging.ConsoleHandler.level=FINEST
   java.util.logging.ConsoleHandler.filter=com.sun.sgs.impl.sharedutil.logging.ExceptionFilter
   com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.exception=com.sun.sgs.app.TransactionAbortedException
   com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.level=WARNING
 


Field Summary
static String EXCEPTION_CLASS_PROPERTY
          The property that specifies the exception class.
static String LEVEL_PROPERTY
          The property that specifies the logging level for log records that do not contain an exception of the specified exception class.
 
Constructor Summary
ExceptionFilter()
          Creates an instance of this class.
 
Method Summary
 boolean isLoggable(LogRecord record)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXCEPTION_CLASS_PROPERTY

public static final String EXCEPTION_CLASS_PROPERTY
The property that specifies the exception class.

See Also:
Constant Field Values

LEVEL_PROPERTY

public static final String LEVEL_PROPERTY
The property that specifies the logging level for log records that do not contain an exception of the specified exception class.

See Also:
Constant Field Values
Constructor Detail

ExceptionFilter

public ExceptionFilter()
                throws ClassNotFoundException
Creates an instance of this class.

Throws:
ClassNotFoundException - if the exception class is not found
Method Detail

isLoggable

public boolean isLoggable(LogRecord record)

This implementation returns true if the log record contains an exception that is a subclass of the class specified by the "com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.exception" log manager property, or if the level of the record is greater than or equal to the logging level specified by the "com.sun.sgs.impl.sharedutil.logging.ExceptionFilter.level" property.

Specified by:
isLoggable in interface Filter

Project Darkstar, Version 0.9.9.4
2013-07-29 20:49:18

Copyright © 2007-2013 Sun Microsystems, Inc. All rights reserved