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)Deprecated.DefaultFileLogHandler(java.nio.file.Path directory, java.lang.String pattern, long maxBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.nio.file.PathgetDirectory()java.nio.file.PathgetEntry()longgetMaxBytes()java.lang.StringgetPattern()longgetWrittenBytes()voidhandle(@NotNull 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
@Deprecated public DefaultFileLogHandler(java.io.File directory, java.lang.String pattern, long maxBytes)Deprecated.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
-
DefaultFileLogHandler
public DefaultFileLogHandler(java.nio.file.Path directory, java.lang.String pattern, long maxBytes)
-
-
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(@NotNull @NotNull LogEntry logEntry) throws java.lang.ExceptionDescription 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- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classAbstractLogHandler- Throws:
java.lang.Exception
-
getDirectory
public java.nio.file.Path getDirectory()
-
getPattern
public java.lang.String getPattern()
-
getMaxBytes
public long getMaxBytes()
-
getEntry
public java.nio.file.Path getEntry()
-
getWrittenBytes
public long getWrittenBytes()
-
-