org.jlog2.exception
Class WriteMessageException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.jlog2.exception.WriteMessageException
All Implemented Interfaces:
java.io.Serializable

public class WriteMessageException
extends java.lang.Exception

This class can be used to throw an exception indicating that the message should be logged only once. If used with the ExceptionHandler of this package and the appropriate setting, it will write only the message part and also only use the exception once. If used once, an EndOfException exception is then returned instead. This means that you can catch and write the exception several times, or only once, which might lead to tidier logging.

See Also:
Serialized Form

Constructor Summary
WriteMessageException(java.lang.String message)
          Create a new instance of WriteMessageException.
WriteMessageException(java.lang.String message, boolean thisUseOnce)
          Create a new instance of WriteMessageException.
 
Method Summary
protected  boolean getUseOnce()
          Get the value indicating to use only once.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WriteMessageException

public WriteMessageException(java.lang.String message)
Create a new instance of WriteMessageException. This exception is passed through each time, although only the message part gets written to the logger.

Parameters:
message - the error message.

WriteMessageException

public WriteMessageException(java.lang.String message,
                             boolean thisUseOnce)
Create a new instance of WriteMessageException.

Parameters:
message - the error message.
thisUseOnce - if true pass through the logger only once, if false, then pass through the logger each time.
Method Detail

getUseOnce

protected boolean getUseOnce()
Get the value indicating to use only once.

Returns:
the value of useOnce.