edu.northwestern.at.utils.logger

## Class BaseLogger

- java.lang.Object
- - edu.northwestern.at.utils.logger.BaseLogger

- All Implemented Interfaces:
    Logger

      public class BaseLogger
      extends java.lang.Object
      implements Logger

  Base logger which wraps Jakarta Common Logging Log manager.

  This class is a simple wrapper around Jakarta Common Logging log4j loggers.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Object` | `lock` Lock for synchronizing output.
    `protected org.apache.log4j.Logger` | `logger` Log4J logger.
    `protected boolean` | `loggerEnabled` True if logger enabled.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseLogger(java.lang.String logClassName, java.lang.String logPath, java.lang.String logConfigFilePath)` Create a logger.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isDebuggingEnabled()` Returns true if debugging messages are enabled.
    `boolean` | `isLoggerEnabled()` Returns true if logger is enabled.
    `void` | `log(int level, java.lang.String str)` Logs a message.
    `void` | `log(int level, java.lang.String str, java.lang.Throwable t)` Logs a message with a stack trace.
    `void` | `logDebug(java.lang.String str)` Logs a message at the DEBUG level.
    `void` | `logError(java.lang.String str)` Logs a message at the ERROR level.
    `void` | `logError(java.lang.String str, java.lang.Throwable t)` Logs a error message with a stack trace.
    `void` | `logFatal(java.lang.String str)` Logs a message at the FATAL level.
    `void` | `logFatal(java.lang.String str, java.lang.Throwable t)` Logs a fatal message with a stack trace.
    `void` | `logInfo(java.lang.String str)` Logs a message at the INFO level.
    `void` | `logWarning(java.lang.String str)` Logs a message at the WARN level.
    `protected static org.apache.log4j.Priority` | `mapLevel(int level)` Maps a LoggerConstants level to log4j level.
    `void` | `terminate()` Terminates the logger.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected org.apache.log4j.Logger logger

      Log4J logger.

    - #### loggerEnabled

          protected boolean loggerEnabled

      True if logger enabled.

    - #### lock

          protected java.lang.Object lock

      Lock for synchronizing output.

  - ### Constructor Detail

    - #### BaseLogger

          public BaseLogger(java.lang.String logClassName,
                    java.lang.String logPath,
                    java.lang.String logConfigFilePath)
                     throws java.io.FileNotFoundException,
                            java.io.IOException

      Create a logger.
      Parameters:
        `logClassName` - The log class name.
        `logPath` - The path in which to store log files.
        `logConfigFilePath` - Path to log configuration file.

        Reads the configuration file, creates a Log4J logger for the specified class name, and configures the logger.

      Throws:
        `java.io.FileNotFoundException`
        `java.io.IOException`

  - ### Method Detail

    - #### terminate

          public void terminate()

      Terminates the logger.
      Specified by:
        `terminate` in interface `Logger`

    - #### mapLevel

          protected static org.apache.log4j.Priority mapLevel(int level)

      Maps a LoggerConstants level to log4j level.
      Parameters:
        `level` - LoggerConstants level.
      Returns:
        log4j level.

    - #### logDebug

          public void logDebug(java.lang.String str)

      Logs a message at the DEBUG level.
      Specified by:
        `logDebug` in interface `Logger`
      Parameters:
        `str` - Log message.

    - #### logInfo

          public void logInfo(java.lang.String str)

      Logs a message at the INFO level.
      Specified by:
        `logInfo` in interface `Logger`
      Parameters:
        `str` - Log message.

    - #### logWarning

          public void logWarning(java.lang.String str)

      Logs a message at the WARN level.
      Specified by:
        `logWarning` in interface `Logger`
      Parameters:
        `str` - Log message.

    - #### logError

          public void logError(java.lang.String str)

      Logs a message at the ERROR level.
      Specified by:
        `logError` in interface `Logger`
      Parameters:
        `str` - Log message.

    - #### logError

          public void logError(java.lang.String str,
                      java.lang.Throwable t)

      Logs a error message with a stack trace.
      Specified by:
        `logError` in interface `Logger`
      Parameters:
        `str` - Log message.
        `t` - Throwable.

    - #### logFatal

          public void logFatal(java.lang.String str)

      Logs a message at the FATAL level.
      Specified by:
        `logFatal` in interface `Logger`
      Parameters:
        `str` - Log message.

    - #### logFatal

          public void logFatal(java.lang.String str,
                      java.lang.Throwable t)

      Logs a fatal message with a stack trace.
      Specified by:
        `logFatal` in interface `Logger`
      Parameters:
        `str` - Log message.
        `t` - Throwable.

    - #### log

          public void log(int level,
                 java.lang.String str)

      Logs a message.
      Specified by:
        `log` in interface `Logger`
      Parameters:
        `level` - Log message level.
        `str` - Log message.

    - #### log

          public void log(int level,
                 java.lang.String str,
                 java.lang.Throwable t)

      Logs a message with a stack trace.
      Specified by:
        `log` in interface `Logger`
      Parameters:
        `level` - Log message level.
        `str` - Log message.
        `t` - Throwable.

    - #### isDebuggingEnabled

          public boolean isDebuggingEnabled()

      Returns true if debugging messages are enabled.
      Specified by:
        `isDebuggingEnabled` in interface `Logger`
      Returns:
        True if debugging messages are enabled.

    - #### isLoggerEnabled

          public boolean isLoggerEnabled()

      Returns true if logger is enabled.
      Specified by:
        `isLoggerEnabled` in interface `Logger`
      Returns:
        True if logger is enabled.