Package org.rapidcontext.util
Class LogFileHandler
java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
org.rapidcontext.util.LogFileHandler
A java.util.logging file handler with support for date patterns in
log file name. Log file rotation is based on the file name pattern
date format.
Configured by the following properties:
[class-name].level-- a minimum log level (Level.ALL)[class-name].filter-- an optional log filter (none)[class-name].formatter-- a log formatter (org.rapidcontext.util.LogFormatter)[class-name].encoding-- an optional encoding (platform default)[class-name].pattern-- a log file name pattern, including the file path ("%t/rapidcontext-%d{yyyy-MM-dd}.log")[class-name].append-- a log append flag (true)
A log file pattern may contain the following special character sequences:
"%t"-- the system temporary directory"%h"-- the value of the "user.home" system property"%d"-- the current date (in YYYY-MM-DD format)"%d{...}"-- a generic date and time format (using SimpleDateFormat pattern)"%%"-- a single percent sign "%"
- Version:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new log file handler using LogManager configuration properties.LogFileHandler(String pattern, boolean append) Creates a new log file handler. -
Method Summary
Methods inherited from class java.util.logging.StreamHandler
close, flush, isLoggable, setEncoding, setOutputStreamMethods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
LogFileHandler
Creates a new log file handler using LogManager configuration properties.- Throws:
SecurityException- if logging control permission is missingReflectiveOperationException- if configuration was incorrectIOException- if the configured log file couldn't be created
-
LogFileHandler
public LogFileHandler(String pattern, boolean append) throws SecurityException, ReflectiveOperationException, IOException Creates a new log file handler.- Parameters:
pattern- the log file patternappend- the append existing file flag- Throws:
SecurityException- if logging control permission is missingReflectiveOperationException- if configuration was incorrectIOException- if the configured log file couldn't be created
-
-
Method Details
-
publish
Formats and publishes a log record.- Overrides:
publishin classStreamHandler- Parameters:
entry- the log entry to publish
-