public class LogPrinterFile extends AbstractLogPrinter
Note that you may use setFileSizeLimit(int)
set a limit for the number of lines
that go into one logfile. If this number is exceeded a new file will be created automatically -
and a ChangeEvent is fired in order to notify interested listeners.
Constructor and Description |
---|
LogPrinterFile(LogChannel channel,
java.io.File logDir)
Opens a new LogPrinterFile which receives messages from the given LogChannel and logs them
into a logfile which is created under the given log-directory.
|
LogPrinterFile(LogChannel channel,
java.io.File logDir,
java.io.File lastLogFile) |
Modifier and Type | Method and Description |
---|---|
void |
addFileChangeListener(LogFileChangeEvent.Listener l) |
void |
close()
Closes the file-stream and deregisters from the underlying
LogChannel . |
protected java.io.File |
createFile(java.io.File logDir)
Creates the filename for the log file.
|
java.io.File |
getFile()
Returns the file currently being written into.
|
int |
getFileCount()
Returns the number of files opened since started.
|
int |
getLineCount()
Returns the number of lines already written to the current logfile.
|
TextPrintable |
getOutput(LogLevel currLevel)
Overridden to lead the output to the file stream.
|
java.lang.String |
getTypeString()
Returns a unique string that identifies this LogPrinter.
|
void |
openNextFile()
Quits the current logfile and opens the next one
|
void |
removeFileChangeListener(LogFileChangeEvent.Listener l) |
void |
setMaxLinesLimit(int numLines)
Sets the logging limit for the log-files to the given number of lines, 0 = unlimited.
|
addLogLevelListener, getLogChannel, getLogFormatter, getLogLevel, getLogMessageListener, isClosed, isSilent, processLogMessage, removeLogLevelListener, setLogFormatter, setLogLevel, setSilent, toString
public LogPrinterFile(LogChannel channel, java.io.File logDir) throws java.lang.Exception
java.lang.Exception
public LogPrinterFile(LogChannel channel, java.io.File logDir, java.io.File lastLogFile) throws java.lang.Exception
java.lang.Exception
public final java.io.File getFile()
public final int getFileCount()
public final int getLineCount()
public final void close()
LogChannel
.close
in interface LogPrinter
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class AbstractLogPrinter
public final void setMaxLinesLimit(int numLines)
protected java.io.File createFile(java.io.File logDir)
public final TextPrintable getOutput(LogLevel currLevel)
public final void openNextFile()
public java.lang.String getTypeString()
EnvStore
.public final void addFileChangeListener(LogFileChangeEvent.Listener l)
public final void removeFileChangeListener(LogFileChangeEvent.Listener l)
Copyright © 2014 EsprIT-Systems. All Rights Reserved.