jSyncManager Simple Java Server

org.jSyncManager.SJS
Class LogManager

java.lang.Object
  extended by org.jSyncManager.SJS.LogManager

public class LogManager
extends java.lang.Object

A class for managing log files. This class will create a log file with the current date/time as the filename, with the specified file extension. When the log reaches a specified size (default of 2MB), a new log file will be created.

Version:
0.1
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>

Constructor Summary
LogManager(java.lang.String filePath, java.lang.String fileExtension, java.lang.String moduleName)
          Creates a new Log Manager instance.
LogManager(java.lang.String filePath, java.lang.String fileExtension, java.lang.String moduleName, long maxSize)
          Creates a new Log Manager instance.
 
Method Summary
 void close()
          Closes the log file.
protected  void finalize()
          Finalizes the log file.
 void writeCriticalEntry(java.lang.String message)
          Writes a critical information log entry to the log file.
 void writeExceptionEntry(java.lang.String message)
          Writes an exception information log entry to the log file.
 void writeExceptionEntry(java.lang.Throwable exception)
          Writes a throwable (exception/error) object to the log file.
 void writeGeneralEntry(java.lang.String message)
          Writes a general information log entry to the log file.
 void writeWarningEntry(java.lang.String message)
          Writes a warning information log entry to the log file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogManager

public LogManager(java.lang.String filePath,
                  java.lang.String fileExtension,
                  java.lang.String moduleName)
           throws java.io.IOException
Creates a new Log Manager instance.

Parameters:
filePath - the path to write the log file to.
fileExtension - the extension to use for the filename.
moduleName - the name of the module to be logged.
Throws:
java.io.IOException - if an I/O exception occurs during construction.

LogManager

public LogManager(java.lang.String filePath,
                  java.lang.String fileExtension,
                  java.lang.String moduleName,
                  long maxSize)
           throws java.io.IOException
Creates a new Log Manager instance.

Parameters:
filePath - the path to write the log file to.
fileExtension - the extension to use for the filename.
moduleName - the name of the module to be logged.
maxSize - the maximum size that the log file can reach before creating a new log file.
Throws:
java.io.IOException - if an I/O excepttion occurs during construction.
Method Detail

writeGeneralEntry

public void writeGeneralEntry(java.lang.String message)
Writes a general information log entry to the log file.

Parameters:
message - the message to be logged.

writeCriticalEntry

public void writeCriticalEntry(java.lang.String message)
Writes a critical information log entry to the log file.

Parameters:
message - the message to be logged.

writeWarningEntry

public void writeWarningEntry(java.lang.String message)
Writes a warning information log entry to the log file.

Parameters:
message - the message to be logged.

writeExceptionEntry

public void writeExceptionEntry(java.lang.String message)
Writes an exception information log entry to the log file.

Parameters:
message - the message to be logged.

writeExceptionEntry

public void writeExceptionEntry(java.lang.Throwable exception)
Writes a throwable (exception/error) object to the log file. Calls to this method will cause the throwables text and stack trace to be written to the log file.

Parameters:
exception - the throwable to be logged.

close

public void close()
Closes the log file.


finalize

protected void finalize()
Finalizes the log file.

Overrides:
finalize in class java.lang.Object

jSyncManager Simple Java Server

Copyright (c) 2004 Brad BARCLAY. All Rights Reserved.