org.bibalex.daf.managers.logmanager
Class LogManager

java.lang.Object
  extended by org.bibalex.daf.managers.logmanager.LogManager

public class LogManager
extends java.lang.Object

Author:
Shehab.Kamal

Field Summary
private static org.apache.log4j.Logger logger
          Holds the logger instance used to log events throughout the program.
 
Constructor Summary
LogManager()
           
 
Method Summary
static void debug(java.lang.Object message)
          Writes the given message as a category 'Debug' message.
static void error(java.lang.Object message)
          Writes the given message as a category 'Error' message.
static void fatal(java.lang.Object message)
          Writes the given message as a category'Fatal' message.
static void info(java.lang.Object message)
          Writes the given message as a category 'Info' message.
static void init()
          Initializes the LogManager underlying logger.
private static void pushNDC()
          Pushs the machine name into the NDC.
static java.lang.String readLog()
          Reads a certain number of characters from the log file.
Note: The method assumes a file named EventLog.log at the jar
static void warn(java.lang.Object message)
          Writes the given message as a category 'Warn' message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.log4j.Logger logger
Holds the logger instance used to log events throughout the program.

Constructor Detail

LogManager

public LogManager()
Method Detail

init

public static void init()
Initializes the LogManager underlying logger.


debug

public static void debug(java.lang.Object message)
Writes the given message as a category 'Debug' message.

Parameters:
message - The message to be logged.

info

public static void info(java.lang.Object message)
Writes the given message as a category 'Info' message.

Parameters:
message - The message to be logged.

warn

public static void warn(java.lang.Object message)
Writes the given message as a category 'Warn' message.

Parameters:
message - The message to be logged.

error

public static void error(java.lang.Object message)
Writes the given message as a category 'Error' message.

Parameters:
message - The message to be logged.

fatal

public static void fatal(java.lang.Object message)
Writes the given message as a category'Fatal' message.

Parameters:
message - The message to be logged.

pushNDC

private static void pushNDC()
Pushs the machine name into the NDC.


readLog

public static java.lang.String readLog()
Reads a certain number of characters from the log file.
Note: The method assumes a file named EventLog.log at the jar

Returns:
A String containg text read from the log file.
An empty string is returned in the following cases:
1) The log file doesn't exist
2) The file is empty
3) An execption occurred