LoggerLog4j

public class LoggerLog4j extends PersistentComponent implements hk.hku.cecid.piazza.commons.util.Logger

LoggerLog4j is an implementation of a Logger and is backed by a Log4j logger.

Author:Hugo Y. K. Lam

See also: org.apache.log4j.Logger

Constructors

LoggerLog4j

public LoggerLog4j()

Creates a new instance of LoggerLog4j.

LoggerLog4j

public LoggerLog4j(URL url)

Creates a new instance of LoggerLog4j.

Parameters:
  • url – the url of the configuration file.
Throws:
  • ComponentException – if the configuration could not be loaded from the specified url.

LoggerLog4j

public LoggerLog4j(String name)

Creates a new instance of LoggerLog4j.

Parameters:
  • name – the logger category name. null if the name should be looked up dynamically in logging.

LoggerLog4j

public LoggerLog4j(String name, URL url)

Creates a new instance of LoggerLog4j.

Parameters:
  • name – the logger category name. null if the name should be looked up dynamically in logging.
  • url – the url of the configuration file.
Throws:
  • UtilitiesException – if the configuration could not be loaded from the specified url.

Methods

debug

public void debug(Object msg)

See also: hk.hku.cecid.piazza.commons.util.Logger.debug(java.lang.Object)

debug

public void debug(Object msg, Throwable throwable)

See also: hk.hku.cecid.piazza.commons.util.Logger.debug(java.lang.Object,java.lang.Throwable)

error

public void error(Object msg)

See also: hk.hku.cecid.piazza.commons.util.Logger.error(java.lang.Object)

error

public void error(Object msg, Throwable throwable)

See also: hk.hku.cecid.piazza.commons.util.Logger.error(java.lang.Object,java.lang.Throwable)

fatal

public void fatal(Object msg)

See also: hk.hku.cecid.piazza.commons.util.Logger.fatal(java.lang.Object)

fatal

public void fatal(Object msg, Throwable throwable)

See also: hk.hku.cecid.piazza.commons.util.Logger.fatal(java.lang.Object,java.lang.Throwable)

info

public void info(Object msg)

See also: hk.hku.cecid.piazza.commons.util.Logger.info(java.lang.Object)

info

public void info(Object msg, Throwable throwable)

See also: hk.hku.cecid.piazza.commons.util.Logger.info(java.lang.Object,java.lang.Throwable)

init

protected void init()

Initializes this logger and sets a default logger if specified.

Throws:
  • Exception – if error occurred in initialization.

See also: hk.hku.cecid.piazza.commons.module.Component.init()

isDebugEnabled

public boolean isDebugEnabled()

Checks if the logger itself is in debug mode.

Returns:true if the logger itself is in debug mode.

loading

protected void loading(URL url)

Loads the configuration from the specified url location. A DOM configuration will be triggered if the url ends with ”.xml”.

Parameters:
  • url – the url of the configuration source.
Throws:
  • Exception – if the operation is unsuccessful.

See also: hk.hku.cecid.piazza.commons.module.PersistentComponent.loading(java.net.URL)

warn

public void warn(Object msg)

See also: hk.hku.cecid.piazza.commons.util.Logger.warn(java.lang.Object)

warn

public void warn(Object msg, Throwable throwable)

See also: hk.hku.cecid.piazza.commons.util.Logger.warn(java.lang.Object,java.lang.Throwable)