Openfire 3.6.3 Javadoc

org.jivesoftware.util.log
Class Logger

java.lang.Object
  extended by org.jivesoftware.util.log.Logger

public class Logger
extends Object

The object interacted with by client objects to perform logging.

Author:
Peter Donald

Field Summary
static char CATEGORY_SEPARATOR
           
 
Method Summary
 void debug(String message)
          Log a debug priority event.
 void debug(String message, Throwable throwable)
          Log a debug priority event.
 void error(String message)
          Log a error priority event.
 void error(String message, Throwable throwable)
          Log a error priority event.
 void fatalError(String message)
          Log a fatalError priority event.
 void fatalError(String message, Throwable throwable)
          Log a fatalError priority event.
 String getCategory()
          Deprecated. This method violates Inversion of Control principle. If you are relying on its presence then there may be something wrong with the design of your system
 Logger getChildLogger(String subCategory)
          Create a new child logger.
 Logger[] getChildren()
          Get all the child Loggers of current logger.
 LogTarget[] getLogTargets()
          Get a copy of log targets for this logger.
 Priority getPriority()
          Deprecated. This method violates Inversion of Control principle. It will downgraded to protected access in a future release. When user needs to check priority it is advised that they use the is[Priority]Enabled() functions.
 void info(String message)
          Log a info priority event.
 void info(String message, Throwable throwable)
          Log a info priority event.
 boolean isDebugEnabled()
          Determine if messages of priority DEBUG will be logged.
 boolean isErrorEnabled()
          Determine if messages of priority ERROR will be logged.
 boolean isFatalErrorEnabled()
          Determine if messages of priority FATAL_ERROR will be logged.
 boolean isInfoEnabled()
          Determine if messages of priority INFO will be logged.
 boolean isPriorityEnabled(Priority priority)
          Determine if messages of priority will be logged.
 boolean isWarnEnabled()
          Determine if messages of priority WARN will be logged.
 void log(Priority priority, String message)
          Log a event at specific priority with a certain message.
 void log(Priority priority, String message, Throwable throwable)
          Log a event at specific priority with a certain message and throwable.
 void setAdditivity(boolean additivity)
          Make this logger additive, which means send all log events to parent loggers LogTargets regardless of whether or not the LogTargets have been overidden.
 void setLogTargets(LogTarget[] logTargets)
          Set the log targets for this logger.
 void setPriority(Priority priority)
          Set the priority for this logger.
 void unsetLogTargets()
          Unset the logtargets for this logger.
 void unsetLogTargets(boolean recursive)
          Unset the logtargets for this logger and all child loggers if recursive is set.
 void unsetPriority()
          Unset the priority of Logger.
 void unsetPriority(boolean recursive)
          Unset the priority of Logger.
 void warn(String message)
          Log a warn priority event.
 void warn(String message, Throwable throwable)
          Log a warn priority event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_SEPARATOR

public static final char CATEGORY_SEPARATOR
See Also:
Constant Field Values
Method Detail

isDebugEnabled

public final boolean isDebugEnabled()
Determine if messages of priority DEBUG will be logged.

Returns:
true if DEBUG messages will be logged

debug

public final void debug(String message,
                        Throwable throwable)
Log a debug priority event.

Parameters:
message - the message
throwable - the throwable

debug

public final void debug(String message)
Log a debug priority event.

Parameters:
message - the message

isInfoEnabled

public final boolean isInfoEnabled()
Determine if messages of priority INFO will be logged.

Returns:
true if INFO messages will be logged

info

public final void info(String message,
                       Throwable throwable)
Log a info priority event.

Parameters:
message - the message

info

public final void info(String message)
Log a info priority event.

Parameters:
message - the message

isWarnEnabled

public final boolean isWarnEnabled()
Determine if messages of priority WARN will be logged.

Returns:
true if WARN messages will be logged

warn

public final void warn(String message,
                       Throwable throwable)
Log a warn priority event.

Parameters:
message - the message
throwable - the throwable

warn

public final void warn(String message)
Log a warn priority event.

Parameters:
message - the message

isErrorEnabled

public final boolean isErrorEnabled()
Determine if messages of priority ERROR will be logged.

Returns:
true if ERROR messages will be logged

error

public final void error(String message,
                        Throwable throwable)
Log a error priority event.

Parameters:
message - the message
throwable - the throwable

error

public final void error(String message)
Log a error priority event.

Parameters:
message - the message

isFatalErrorEnabled

public final boolean isFatalErrorEnabled()
Determine if messages of priority FATAL_ERROR will be logged.

Returns:
true if FATAL_ERROR messages will be logged

fatalError

public final void fatalError(String message,
                             Throwable throwable)
Log a fatalError priority event.

Parameters:
message - the message
throwable - the throwable

fatalError

public final void fatalError(String message)
Log a fatalError priority event.

Parameters:
message - the message

setAdditivity

public final void setAdditivity(boolean additivity)
Make this logger additive, which means send all log events to parent loggers LogTargets regardless of whether or not the LogTargets have been overidden.

This is derived from Log4js notion of Additivity.

Parameters:
additivity - true to make logger additive, false otherwise

isPriorityEnabled

public final boolean isPriorityEnabled(Priority priority)
Determine if messages of priority will be logged.

Returns:
true if messages will be logged

log

public final void log(Priority priority,
                      String message,
                      Throwable throwable)
Log a event at specific priority with a certain message and throwable.

Parameters:
message - the message
priority - the priority
throwable - the throwable

log

public final void log(Priority priority,
                      String message)
Log a event at specific priority with a certain message.

Parameters:
message - the message
priority - the priority

setPriority

public void setPriority(Priority priority)
Set the priority for this logger.

Parameters:
priority - the priority

unsetPriority

public void unsetPriority()
Unset the priority of Logger. (Thus it will use it's parent's priority or DEBUG if no parent.


unsetPriority

public void unsetPriority(boolean recursive)
Unset the priority of Logger. (Thus it will use it's parent's priority or DEBUG if no parent. If recursive is true unset priorities of all child loggers.

Parameters:
recursive - true to unset priority of all child loggers

setLogTargets

public void setLogTargets(LogTarget[] logTargets)
Set the log targets for this logger.

Parameters:
logTargets - the Log Targets

unsetLogTargets

public void unsetLogTargets()
Unset the logtargets for this logger. This logger (and thus all child loggers who don't specify logtargets) will inherit from the parents LogTargets.


unsetLogTargets

public void unsetLogTargets(boolean recursive)
Unset the logtargets for this logger and all child loggers if recursive is set. The loggers unset (and all child loggers who don't specify logtargets) will inherit from the parents LogTargets.


getChildren

public Logger[] getChildren()
Get all the child Loggers of current logger.

Returns:
the child loggers

getChildLogger

public Logger getChildLogger(String subCategory)
                      throws IllegalArgumentException
Create a new child logger. The category of child logger is [current-category].subcategory

Parameters:
subCategory - the subcategory of this logger
Returns:
the new logger
Throws:
IllegalArgumentException - if subCategory has an empty element name

getPriority

public final Priority getPriority()
Deprecated. This method violates Inversion of Control principle. It will downgraded to protected access in a future release. When user needs to check priority it is advised that they use the is[Priority]Enabled() functions.

Retrieve priority associated with Logger.

Returns:
the loggers priority

getCategory

public final String getCategory()
Deprecated. This method violates Inversion of Control principle. If you are relying on its presence then there may be something wrong with the design of your system

Retrieve category associated with logger.

Returns:
the Category

getLogTargets

public LogTarget[] getLogTargets()
Get a copy of log targets for this logger.

Returns:
the child loggers

Openfire 3.6.3 Javadoc

Copyright © 2003-2008 Jive Software.