Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.util
Class FileHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by java.util.logging.FileHandler
              extended by net.java.sip.communicator.util.FileHandler

public class FileHandler
extends FileHandler

Simple file logging Handler. Extends java.util.logging.FileHandler and adds the special component to the file pattern - %s which is replaced at runtime with sip-communicator's home directory. If the pattern option is missing creates log directory in sip-communicator's home directory. If the directory is missing create it.

Author:
Damian Minkov

Field Summary
static String pattern
          Specifies a pattern for generating the output file name.
 
Constructor Summary
FileHandler()
          Construct a default FileHandler.
FileHandler(String pattern, int limit, int count)
          Initialize a FileHandler to write to a set of files.
 
Method Summary
 
Methods inherited from class java.util.logging.FileHandler
close, publish
 
Methods inherited from class java.util.logging.StreamHandler
flush, isLoggable, setEncoding, setOutputStream
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

public static String pattern
Specifies a pattern for generating the output file name. A pattern consists of a string that includes the special components that will be replaced at runtime such as : %t, %h, %g, %u. Also adds the special component : %s sip-communicator's home directory, typically - ${net.java.sip.communicator.SC_HOME_DIR_LOCATION}/ ${net.java.sip.communicator.SC_HOME_DIR_NAME}.

The field is public so that our Logger could reset it if necessary.

Constructor Detail

FileHandler

public FileHandler(String pattern,
                   int limit,
                   int count)
            throws IOException,
                   SecurityException
Initialize a FileHandler to write to a set of files. When (approximately) the given limit has been written to one file, another file will be opened. The output will cycle through a set of count files.

The FileHandler is configured based on LogManager properties (or their default values) except that the given pattern argument is used as the filename pattern, the file limit is set to the limit argument, and the file count is set to the given count argument.

The count must be at least 1.

Parameters:
pattern - the pattern for naming the output file
limit - the maximum number of bytes to write to any one file
count - the number of files to use
Throws:
IOException - if there are IO problems opening the files.
SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").
IllegalArgumentException - if limit < 0, or count < 1.
IllegalArgumentException - if pattern is an empty string

FileHandler

public FileHandler()
            throws IOException,
                   SecurityException
Construct a default FileHandler. This will be configured entirely from LogManager properties (or their default values). Will change

Throws:
IOException - if there are IO problems opening the files.
SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control")).
NullPointerException - if pattern property is an empty String.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.