org.jlf.log.fileMechanisms
Class AbstractFileLoggingMechanism
java.lang.Object
|
+--org.jlf.log.AbstractLoggingMechanism
|
+--org.jlf.log.fileMechanisms.AbstractFileLoggingMechanism
- Direct Known Subclasses:
- SharedFileLoggingMechanism, UniqueFileLoggingMechanism
- public abstract class AbstractFileLoggingMechanism
- extends AbstractLoggingMechanism
AbstractFileLoggingMechanism is an abstract class which
defines the format and location of log files,
so they all work consistently for the same application. The default
file name where logs are created is:
[Path][App][LogClass][date].[extn]
where: [Path] = "c:\temp\"
[App] = "App"
[LogClass] = The Java Class name of the Log Class
(only used for unique logs)
[date] = today's date (only used for dated logs)
[extn] = "log"
The [App] default can be overridden by the application, it is taken
from the LogManager class. The [Path] and [extn] defaults can be
overridden by settings in a properties file, see the LogProperties
class for more information.
Field Summary |
protected java.lang.String |
currentFileName
Instance variable to hold the current output file name |
protected java.io.FileOutputStream |
fileOutputStream
|
protected static java.lang.String |
logPath
|
Method Summary |
protected void |
close()
This method closes the particular logging mechanism so that messages
no longer get logged to the mechanism. |
java.lang.String |
getFileName()
|
protected java.lang.String |
logFileNamePrefix(Log log)
|
protected java.lang.String |
logFileNameSuffix(Log log)
|
protected void |
open(Log log)
This method opens the particular logging mechanism so that messages
can be output to the printSteam instance variable. |
java.lang.String |
toString()
Return a nice debug string. |
Methods inherited from class org.jlf.log.AbstractLoggingMechanism |
closeForLog, compactCurrentDate, currentDate, currentTime, getLoggingMechanismForString, getName, hasDateRolledOver, isDatedLog, isSharedLog, loggingPrefix, logString, notifyLogClosed, notifyLoggingLevelChange, notifyLogOpened, openForLog, rollLogOver |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
logPath
protected static java.lang.String logPath
fileOutputStream
protected java.io.FileOutputStream fileOutputStream
currentFileName
protected java.lang.String currentFileName
- Instance variable to hold the current output file name
AbstractFileLoggingMechanism
public AbstractFileLoggingMechanism()
logFileNamePrefix
protected java.lang.String logFileNamePrefix(Log log)
logFileNameSuffix
protected java.lang.String logFileNameSuffix(Log log)
getFileName
public java.lang.String getFileName()
open
protected void open(Log log)
- Description copied from class:
AbstractLoggingMechanism
- This method opens the particular logging mechanism so that messages
can be output to the printSteam instance variable.
- Overrides:
open
in class AbstractLoggingMechanism
close
protected void close()
- Description copied from class:
AbstractLoggingMechanism
- This method closes the particular logging mechanism so that messages
no longer get logged to the mechanism. Overrides should call the superclass
method so that printStream gets reset to StdErr in case a subsequent open
has problems and the error can be logged somewhere!
- Overrides:
close
in class AbstractLoggingMechanism
toString
public java.lang.String toString()
- Return a nice debug string.
- Overrides:
toString
in class AbstractLoggingMechanism