Package org.apache.catalina.logger
Class FileLogger
- java.lang.Object
-
- org.apache.catalina.logger.LoggerBase
-
- org.apache.catalina.logger.FileLogger
-
public class FileLogger extends LoggerBase
Implementation of Logger that appends log messages to a file named {prefix}.{date}.{suffix} in a configured directory, with an optional preceding timestamp.- Version:
- $Revision: 1.3 $ $Date: 2006/10/03 20:19:12 $
- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringinfoThe descriptive information about this implementation.-
Fields inherited from class org.apache.catalina.logger.LoggerBase
container, controller, debug, lifecycle, log, oname, rb, support, verbosity
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description FileLogger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDirectory()Return the directory in which we create log files.StringgetPrefix()Return the log file prefix.StringgetSuffix()Return the log file suffix.booleangetTimestamp()Return the timestamp flag.voidlog(String msg)Writes the specified message to a servlet log file, usually an event log.voidsetDirectory(String directory)Set the directory in which we create log files.voidsetPrefix(String prefix)Set the log file prefix.voidsetSuffix(String suffix)Set the log file suffix.voidsetTimestamp(boolean timestamp)Set the timestamp flag.voidstart()Prepare for the beginning of active use of the public methods of this component.voidstop()Gracefully terminate the active use of the public methods of this component.-
Methods inherited from class org.apache.catalina.logger.LoggerBase
addHandler, addLifecycleListener, addPropertyChangeListener, createObjectName, destroy, findLifecycleListeners, getContainer, getController, getDebug, getInfo, getObjectName, getVerbosity, init, log, log, log, log, removeLifecycleListener, removePropertyChangeListener, setContainer, setController, setDebug, setLevel, setVerbosity, setVerbosityLevel
-
-
-
-
Field Detail
-
info
protected static final String info
The descriptive information about this implementation.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDirectory
public String getDirectory()
Return the directory in which we create log files.
-
setDirectory
public void setDirectory(String directory)
Set the directory in which we create log files.- Parameters:
directory- The new log file directory
-
getPrefix
public String getPrefix()
Return the log file prefix.
-
setPrefix
public void setPrefix(String prefix)
Set the log file prefix.- Parameters:
prefix- The new log file prefix
-
getSuffix
public String getSuffix()
Return the log file suffix.
-
setSuffix
public void setSuffix(String suffix)
Set the log file suffix.- Parameters:
suffix- The new log file suffix
-
getTimestamp
public boolean getTimestamp()
Return the timestamp flag.
-
setTimestamp
public void setTimestamp(boolean timestamp)
Set the timestamp flag.- Parameters:
timestamp- The new timestamp flag
-
log
public void log(String msg)
Writes the specified message to a servlet log file, usually an event log. The name and type of the servlet log is specific to the servlet container.- Specified by:
login interfaceLogger- Overrides:
login classLoggerBase- Parameters:
msg- AStringspecifying the message to be written to the log file
-
start
public void start() throws LifecycleExceptionPrepare for the beginning of active use of the public methods of this component. This method should be called afterconfigure(), and before any of the public methods of the component are utilized.- Specified by:
startin interfaceLifecycle- Overrides:
startin classLoggerBase- Throws:
LifecycleException- if this component detects a fatal error that prevents this component from being used
-
stop
public void stop() throws LifecycleExceptionGracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.- Specified by:
stopin interfaceLifecycle- Overrides:
stopin classLoggerBase- Throws:
LifecycleException- if this component detects a fatal error that needs to be reported
-
-