org.jlog2.channel
Class FileChannel

java.lang.Object
  extended by org.jlog2.channel.LogChannel
      extended by org.jlog2.channel.FileChannel

public class FileChannel
extends LogChannel

This class provides a channel to log messages to a file.


Constructor Summary
FileChannel(java.lang.String theFilePath, int theMaxSize, int theBackupNumber)
          Create a new instance of FileChannel.
 
Method Summary
protected  void createLogChannel()
          Create the file channel.
 void finalize()
          Cleanup any open channels.
 void resetChannel(int theMaxSize, int theBackupNumber)
          Reset the FileChannel's file size and number of backups.
 void writeError(java.lang.String message)
          Write an exception to the file channel.
 void writeMessage(java.lang.String message)
          Write the message to the file channel.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChannel

public FileChannel(java.lang.String theFilePath,
                   int theMaxSize,
                   int theBackupNumber)
            throws java.lang.Exception
Create a new instance of FileChannel.

Parameters:
theFilePath - the path of the file to create.
theMaxSize - the maximum allowed size of the file.
theBackupNumber - the maximum number of previous files to keep.
Throws:
java.lang.Exception - any error.
Method Detail

resetChannel

public void resetChannel(int theMaxSize,
                         int theBackupNumber)
                  throws java.lang.Exception
Reset the FileChannel's file size and number of backups.

Parameters:
theMaxSize - the maximum allowed size of the file.
theBackupNumber - the maximum number of previous files to keep.
Throws:
java.lang.Exception - any error.

createLogChannel

protected void createLogChannel()
                         throws java.lang.Exception
Create the file channel.

Specified by:
createLogChannel in class LogChannel
Throws:
java.lang.Exception - any error.

writeMessage

public void writeMessage(java.lang.String message)
                  throws java.lang.Exception
Write the message to the file channel.

Specified by:
writeMessage in class LogChannel
Parameters:
message - the message to write.
Throws:
java.lang.Exception - any error.

writeError

public void writeError(java.lang.String message)
                throws java.lang.Exception
Write an exception to the file channel.

Specified by:
writeError in class LogChannel
Parameters:
message - the message to write.
Throws:
java.lang.Exception - any error.

finalize

public void finalize()
Cleanup any open channels.

Overrides:
finalize in class java.lang.Object