org.norther.tammi.core.base
Class LogException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by org.norther.tammi.core.base.LogException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefaultExceptionFilter

public class LogException
extends IOException

A generic exception supporting consistent run-time error management and configurable logging of run-time exceptions. Every exception to be logged by the server should be thrown as a LogException. An exception to be reported to the user should be thrown as a UserException.

Dynamic data can be added to messages as arguments. The first argument is always the date and time of the exception, and the last one the class name and message of an optional cause throwable. Other arguments can be given as parameters to the constructors of the exception. The following parameters are supported:

The exception maintains a log of thrown exceptions. The properties of the log can be configured separately (not available yet). The static log method can be used to log messages without throwing exceptions.

Version:
$Id: LogException.java,v 1.25 2010-03-23 14:45:36 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
LogException(Log.Level level, String message)
          Constructs an exception at the specified severity level with a message.
LogException(Log.Level level, String message, Object argument)
          Constructs an exception at the specified severity level with a message and argument.
LogException(Log.Level level, String message, Object argument, Throwable cause)
          Constructs an exception at the specified severity level with a message, argument and cause.
LogException(Log.Level level, String message, Throwable cause)
          Constructs an exception at the specified severity level with a message and cause.
LogException(Log.Level level, Throwable cause)
          Constructs an exception at the specified severity level with a cause.
LogException(String message)
          Constructs an exception with a message.
LogException(String message, Object argument)
          Constructs an exception with a message and argument.
LogException(String message, Object argument, Throwable cause)
          Constructs an exception with a message, argument and cause.
LogException(String message, Throwable cause)
          Constructs an exception with a message and cause.
LogException(Throwable cause)
          Constructs an exception with a cause.
 
Method Summary
 boolean equals(Object other)
           
 Object getArgument()
          Gets the argument in the exception.
 Log.Level getLevel()
          Gets the level of the exception.
 String getLocalizedMessage()
           
 String getLocalizedMessage(Object... localization)
          Gets a localized message for the specified localization.
protected  Log getMessageLog()
          Gets the message log.
 long getTime()
          Gets the time of the exception.
 int hashCode()
           
protected  void setLevel(Log.Level level)
          Sets the level of the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogException

public LogException(String message)
Constructs an exception with a message.

Parameters:
message - a message.

LogException

public LogException(Throwable cause)
Constructs an exception with a cause.

Parameters:
cause - a cause throwable.

LogException

public LogException(String message,
                    Throwable cause)
Constructs an exception with a message and cause.

Parameters:
message - a message.
cause - a cause throwable.

LogException

public LogException(String message,
                    Object argument)
Constructs an exception with a message and argument.

Parameters:
message - a message.
argument - an argument.

LogException

public LogException(String message,
                    Object argument,
                    Throwable cause)
Constructs an exception with a message, argument and cause.

Parameters:
message - a message.
argument - an argument.
cause - a cause throwable.

LogException

public LogException(Log.Level level,
                    String message)
Constructs an exception at the specified severity level with a message.

Parameters:
level - the level.
message - a message.

LogException

public LogException(Log.Level level,
                    Throwable cause)
Constructs an exception at the specified severity level with a cause.

Parameters:
level - the level.
cause - a cause throwable.

LogException

public LogException(Log.Level level,
                    String message,
                    Throwable cause)
Constructs an exception at the specified severity level with a message and cause.

Parameters:
level - the level.
message - a message.
cause - a cause throwable.

LogException

public LogException(Log.Level level,
                    String message,
                    Object argument)
Constructs an exception at the specified severity level with a message and argument.

Parameters:
level - the level.
message - a message.
argument - an argument.

LogException

public LogException(Log.Level level,
                    String message,
                    Object argument,
                    Throwable cause)
Constructs an exception at the specified severity level with a message, argument and cause.

Parameters:
level - the level.
message - a message.
argument - an argument.
cause - a cause throwable.
Method Detail

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getLocalizedMessage

public String getLocalizedMessage()
Overrides:
getLocalizedMessage in class Throwable

getLocalizedMessage

public String getLocalizedMessage(Object... localization)
Gets a localized message for the specified localization.

Parameters:
localization - the localization.
Returns:
the localized message or null.

getTime

public long getTime()
Gets the time of the exception.

Returns:
the time of the exception.

getLevel

public Log.Level getLevel()
Gets the level of the exception.

Returns:
the level of the exception.

getArgument

public Object getArgument()
Gets the argument in the exception.

Returns:
the argument in the exception.

setLevel

protected void setLevel(Log.Level level)
Sets the level of the exception.

Parameters:
level - the level.

getMessageLog

protected Log getMessageLog()
Gets the message log.

Returns:
the log.


Copyright © 2004 The Norther Organization. All rights reserved.