Class DefaultFileLogHandler
- java.lang.Object
-
- de.dytanic.cloudnet.common.logging.AbstractLogHandler
-
- de.dytanic.cloudnet.common.logging.DefaultFileLogHandler
-
- All Implemented Interfaces:
ILogHandler,java.lang.AutoCloseable
public final class DefaultFileLogHandler extends AbstractLogHandler
A standard file logger for this LoggingAPI. All important configurations can be made in the constructor
-
-
Field Summary
Fields Modifier and Type Field Description static longSIZE_8MB-
Fields inherited from class de.dytanic.cloudnet.common.logging.AbstractLogHandler
formatter
-
-
Constructor Summary
Constructors Constructor Description DefaultFileLogHandler(java.io.File directory, java.lang.String pattern, long maxBytes)The default constructor with all important configuration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.io.FilegetDirectory()java.io.FilegetEntry()longgetMaxBytes()java.lang.StringgetPattern()java.io.PrintWritergetPrintWriter()longgetWritternBytes()voidhandle(LogEntry logEntry)Allows to handle this incoming LogEntry from the logger This method can invoked asynchronously or synchronously.DefaultFileLogHandlersetEnableErrorLog(boolean enableErrorLog)Enables/disables the error log file (directory/error.log)-
Methods inherited from class de.dytanic.cloudnet.common.logging.AbstractLogHandler
getFormatter, setFormatter
-
-
-
-
Field Detail
-
SIZE_8MB
public static final long SIZE_8MB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultFileLogHandler
public DefaultFileLogHandler(java.io.File directory, java.lang.String pattern, long maxBytes)The default constructor with all important configuration- Parameters:
directory- the default storage for the log filespattern- the file pattern, for the log files like "app.log" will be to than "app.log.0"maxBytes- the maximum bytes, that a log file should have, to switch to the next log file
-
-
Method Detail
-
setEnableErrorLog
public DefaultFileLogHandler setEnableErrorLog(boolean enableErrorLog) throws java.io.IOException
Enables/disables the error log file (directory/error.log)- Parameters:
enableErrorLog- if the file should be created and filled with every error in the console- Throws:
java.io.IOException
-
handle
public void handle(LogEntry logEntry)
Description copied from interface:ILogHandlerAllows to handle this incoming LogEntry from the logger This method can invoked asynchronously or synchronously. It depends on the implementation of the logger and the setting of the LogLevel- Parameters:
logEntry- the new incoming log entry
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classAbstractLogHandler
-
getDirectory
public java.io.File getDirectory()
-
getPattern
public java.lang.String getPattern()
-
getMaxBytes
public long getMaxBytes()
-
getEntry
public java.io.File getEntry()
-
getPrintWriter
public java.io.PrintWriter getPrintWriter()
-
getWritternBytes
public long getWritternBytes()
-
-