Tags

Here is the brief details on Java logging.

Sample Logging File:

java.util.logging.FileHandler.level=INFO
java.util.logging.FileHandler.pattern=${catalina.base}/logs/<filename>%u%g.log
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter

Log Rotation by Size:

java.util.logging.FileHandler.limit=5000
java.util.logging.FileHandler.count=3

Properties:

java.util.logging.FileHandler.level specifies the default level for the Handler (defaults to Level.ALL).

java.util.logging.FileHandler.filter specifies the name of a Filter class to use (defaults to no Filter).

java.util.logging.FileHandler.formatter specifies the name of a Formatter class to use (defaults to java.util.logging.XMLFormatter)

java.util.logging.FileHandler.encoding the name of the character set encoding to use (defaults to the default platform encoding).

java.util.logging.FileHandler.limit specifies an approximate maximum amount to write (in bytes) to any one file. If this is zero, then there is no limit. (Defaults to no limit).

java.util.logging.FileHandler.count specifies how many output files to cycle through (defaults to 1).

java.util.logging.FileHandler.pattern specifies a pattern for generating the output file name. See below for details. (Defaults to “%h/java%u.log”).

java.util.logging.FileHandler.append specifies whether the FileHandler should append onto any existing files (defaults to false).
A pattern consists of a string that includes the following special components that will be replaced at runtime:
“/” the local pathname separator
“%t” the system temporary directory
“%h” the value of the “user.home” system property
“%g” the generation number to distinguish rotated logs
“%u” a unique number to resolve conflicts
“%%” translates to a single percent sign “%”

 

Advertisements