public class RollingFileHandler extends StreamHandler
Handler
. formatting
is given by GSSimpleFormatter
. Configuration: com.gigaspaces.logger.RollingFileHandler.formatter
= com.gigaspaces.logger.GSSimpleFormatter
{..}
. It may also be a placeholder for a custom defined
property. Configuration: com.gigaspaces.logger.RollingFileHandler.filename-pattern
= {gs.logs}/logs/{date,yyyy-MM-dd~HH.mm}-gigaspaces-{service}-{host}-{pid}.log
A place holder value is that of an overriding system property. If no override was specified,
and the property is one of the predefined properties (i.e. homedir, host, pid, date), its value
is evaluated by the handler implementation. If the place holder is of a custom property, and no
value is defined, the propety is left as is. If any error occurs, it is reported and the property
is replaced by an empty string. Example override by system property:
-Dcom.gigaspaces.logger.RollingFileHandler.filename-pattern.date=yyyy-MM-dd
Configuration: com.gigaspaces.logger.RollingFileHandler.append
= false
Configuration:
com.gigaspaces.logger.RollingFileHandler.size-rolling-policy = 2000000
Configuration: com.gigaspaces.logger.RollingFileHandler.time-rolling-policy
= daily
NullBackupPolicy
is configured, which does nothing. It can be
replaced by a DeleteBackupPolicy
to keep a backup of files for a specified period. The
BackupPolicy
interface allows custom implementations to be plugged-in.
Configuration:
com.gigaspaces.logger.RollingFileHandler.backup-policy = com.gigaspaces.logger.DeleteBackupPolicy
com.gigaspaces.logger.DeleteBackupPolicy.period = 30
com.gigaspaces.logger.DeleteBackupPolicy.backup = 10
Level
s) is the level
in which debug messages are displayed to the "standard" output stream. By default the level is
configured to "CONFIG" which displays the log file name. Configuration:
com.gigaspaces.logger.RollingFileHandler.debug-level = CONFIG
-Dcom.gigaspaces.logger.RollingFileHandler.[property-name]=[property-value]
For example: -Dcom.gigaspaces.logger.RollingFileHandler.debug-level=OFF
RollingFileHandlerConfigurer
Modifier and Type | Field and Description |
---|---|
protected static String |
APPEND_PROP |
protected static String |
BACKUP_POLICY_PROP |
protected static String |
DATE_PATTERN_DEFAULT |
protected static String |
DATE_PROP |
protected static String |
DEBUG_LEVEL |
protected static String |
DEBUG_LEVEL_DEFAULT |
protected static String |
FILE_APPEND_DEFAULT |
protected static String |
FILENAME_PATTERN_DEFAULT |
protected static String |
FILENAME_PATTERN_PROP |
protected String |
FILENAME_PATTTERN_PLACEHOLDER_PREFIX
Resolves to the full class name of this handler and the ".filename-pattern" property at the
end.
|
protected static String |
FORMATTER_PROP |
protected String |
HANDLER_PROP_PREFIX
Resolves to the full class name of this handler and a '.' at the end.
|
protected static String |
HOMEDIR_PROP |
protected static String |
HOST_PROP |
protected static String |
LEVEL_PROP |
protected static String |
LOGSDIR_PROP |
protected static String |
PID_PROP |
protected static String |
SERVICE_PROP |
protected static int |
SIZE_ROLLING_POLICY_DEFAULT |
protected static String |
SIZE_ROLLING_POLICY_PROP |
protected static String |
TIME_ROLLING_POLICY_DEFAULT |
protected static String |
TIME_ROLLING_POLICY_PROP |
Constructor and Description |
---|
RollingFileHandler()
Construct a default RollingFileHandler.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
configure()
Configures this logger using the properties provided by the
LogManager.getProperty(String) method. |
static File[] |
filesCreated() |
static boolean |
isMonitoringCreatedFiles() |
static void |
monitorCreatedFiles() |
void |
publish(LogRecord record)
Applies the policies before writing to the stream; re-configures the stream if policy is
triggered.
|
flush, isLoggable, setEncoding, setOutputStream
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
protected final String HANDLER_PROP_PREFIX
logging configuration file:
com.gigaspaces.logger.RollingFileHandler.[property-name]=[property-value]
System property:
-Dcom.gigaspaces.logger.RollingFileHandler.[property-name]=[property-value]
protected static final String LEVEL_PROP
protected static final String FORMATTER_PROP
protected static final String FILENAME_PATTERN_PROP
protected static final String SIZE_ROLLING_POLICY_PROP
protected static final String TIME_ROLLING_POLICY_PROP
protected static final String BACKUP_POLICY_PROP
protected static final String APPEND_PROP
protected static final String DEBUG_LEVEL
protected final String FILENAME_PATTTERN_PLACEHOLDER_PREFIX
-Dcom.gigaspaces.logger.RollingFileHandler.filename-pattern.[placeholder-name]=[placeholder-value]
protected static final String HOMEDIR_PROP
protected static final String LOGSDIR_PROP
protected static final String HOST_PROP
protected static final String PID_PROP
protected static final String SERVICE_PROP
protected static final String DATE_PROP
protected static final String DATE_PATTERN_DEFAULT
protected static final String FILENAME_PATTERN_DEFAULT
protected static final int SIZE_ROLLING_POLICY_DEFAULT
protected static final String TIME_ROLLING_POLICY_DEFAULT
protected static final String FILE_APPEND_DEFAULT
protected static final String DEBUG_LEVEL_DEFAULT
public RollingFileHandler()
public static void monitorCreatedFiles()
public static boolean isMonitoringCreatedFiles()
public static File[] filesCreated()
protected void configure()
LogManager.getProperty(String)
method. More specifically, configures the default ".level",
".formatter", ".filename-pattern", ".size-rolling-policy", ".time-rolling-policy", and
".append" properties. The configure method is called only once at construction, but
before any output stream is open. A user may wish to extend this handler and provide
additional configurations or overrides, before the output stream's file-name is generated.
For example, a user may implement a process ID extension that assigns the appropriate system
property with it's value, that will be used as the replacement for the default process ID
extractor, which relies on ManagementFactory.getRuntimeMXBean().getName()
.public void publish(LogRecord record)
publish
in class StreamHandler
StreamHandler.publish(java.util.logging.LogRecord)
public void close() throws SecurityException
close
in class StreamHandler
SecurityException
Copyright © GigaSpaces.