andyLib v0.9

it.andynaz.log
Class FileLogger

java.lang.Object
  extended by it.andynaz.log.Logger
      extended by it.andynaz.log.FileLogger

public class FileLogger
extends Logger

File Logger. Writes the logs on a text file.

Each constructor calls the corresponding constructor of the Logger class, so the FileLogger object inherits all the properties the Logger class has (and uses all of its options).

Version:
2013/09/17
Author:
andynaz

Field Summary
protected  File logFile
          File in which write the logs.
 
Fields inherited from class it.andynaz.log.Logger
dateFormat, level, name, separator, useDate, useLevel
 
Constructor Summary
FileLogger()
          Creates a FileLogger.
FileLogger(Config conf)
          Deprecated. Use FileLogger(Properties) instead; this method will be removed in future release.
FileLogger(Properties props)
          Creates a FileLogger with a configuration.
FileLogger(String name)
          Creates a FileLogger with a name.
FileLogger(String name, Config conf)
          Deprecated. Use FileLogger(String, Properties) instead; this method will be removed in future release.
FileLogger(String name, Properties props)
          Creates a FileLogger with a name and a configuration.
 
Method Summary
 void log(Exception e, Level level)
          Writes the log of an exception with a specificied level.
 void log(String log, Level level)
          Writes the log.
 
Methods inherited from class it.andynaz.log.Logger
getDate, getPrefix, getPrefix, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logFile

protected File logFile
File in which write the logs.

Constructor Detail

FileLogger

@Deprecated
public FileLogger(String name,
                             Config conf)
Deprecated. Use FileLogger(String, Properties) instead; this method will be removed in future release.

Creates a FileLogger with a name and a configuration.

The path of the file in which write the logs is taken from the property "fileLogger.file".

Parameters:
name - name of the Logger
conf - configuration of the Logger

FileLogger

public FileLogger(String name,
                  Properties props)
Creates a FileLogger with a name and a configuration.

The path of the log file is taken from the property "log.fileLogger.file". Note that the param name is a little different from the one used in the FileLogger(String, Config) method.

Parameters:
name - name of the Logger
props - configuration of the Logger
See Also:
for all the other properties see the Logger constructor

FileLogger

public FileLogger(String name)
Creates a FileLogger with a name. It uses the configuration of the application (taken from ConfigMgr.getConfigParams() method).

Parameters:
name - name of the Logger
See Also:
FileLogger(String, Properties)

FileLogger

@Deprecated
public FileLogger(Config conf)
Deprecated. Use FileLogger(Properties) instead; this method will be removed in future release.

Creates a FileLogger with a configuration.

Parameters:
conf - configuration of the Logger

FileLogger

public FileLogger(Properties props)
Creates a FileLogger with a configuration.

Parameters:
props - configuration of the Logger
See Also:
FileLogger(String, Properties)

FileLogger

public FileLogger()
Creates a FileLogger. It uses the configuration of the application.

See Also:
FileLogger(String, Properties)
Method Detail

log

public void log(String log,
                Level level)
Writes the log. If it is not possible, invokes the Logger.log(String, Level) method.

Overrides:
log in class Logger
Parameters:
log - log to be written
level - log level

log

public void log(Exception e,
                Level level)
Writes the log of an exception with a specificied level. It is written the exception type (with the message of the exception, if present) and the stack trace. All al this elements are written all togheter.

If it is not possible, invokes the Logger.log(Exception, Level) method.

Overrides:
log in class Logger
Parameters:
e - exception to be logged
level - log level

andyLib v0.9

© 2013 andynaz - http://andynaz.altervista.org