public interface LogConfig extends Config, LogDescription
Any number of different Log definitions can be set up within a VM.
LogDescription.LogLevel
Modifier and Type | Method and Description |
---|---|
int |
getFileCount()
Specifies the number of log files to use.
|
void |
setDateFormat(String dateFormat)
Specifies a date format to use for formatting dates used in the %d part
of the file pattern (see {link
setFilePattern(String) ). |
void |
setFileAppend(boolean append)
Sets the file append option.
|
void |
setFileCount(int fileCount)
Sets the file count.
|
void |
setFileLimit(int limit)
Sets the file limit.
|
void |
setFilePattern(String filePattern)
Sets the file pattern.
|
void |
setLevel(LogDescription.LogLevel level)
Sets the starting log level.
|
void |
setLogDirectory(String directory)
Sets the log directory.
|
void |
setRotateDaily(boolean rotateDaily)
Deprecated.
since 5.0
|
void |
setRotationPeriod(int period,
TimeUnit unit)
Set the rotation period of the log file.
|
void |
setXmlFormat(boolean xmlFormat)
Sets the XML format option.
|
getDateFormat, getFileLimit, getFilePattern, getLevel, getLogDirectory, getName, getRotationPeriod, getRotationTimeUnit, isFileAppend, isRotatedDaily, isXmlFormat
void setLogDirectory(String directory) throws ConfigException
The name of the directory to which this log file will be written.
If this is not set explicitly then the default log directory of the owner will be used.
directory
- the log directoryConfigException
- if unable to set the propertyvoid setFilePattern(String filePattern) throws ConfigException
The following may be used within the file name specification:
/ - specifies the local pathname separator.
%t - the system temporary directory
%g - the generation number to distinguish rotated logs
%h - the value of the "user.home" system property
%u - a unique number to resolve conflicts
%s - System type - e.g. 'Diffusion'
%n - System name as defined in Server.xml
%d - Date as specified bysetDateFormat(String)
%% - translates to a single percent sign "%"
If this is not explicitly specified then the default file pattern of "%s.log" is assumed.
filePattern
- the file patternConfigException
- if unable to set the propertyvoid setLevel(LogDescription.LogLevel level) throws ConfigException
SLF4J Log levels are also supported.
If not specified then
INFO
is assumed.
level
- the initial log levelConfigException
- if unable to set the propertyvoid setXmlFormat(boolean xmlFormat) throws ConfigException
Indicates whether the log file should be output in XML format.
If not specified then log will not be in XML format.
xmlFormat
- true for XML formatConfigException
- if unable to set the propertyvoid setDateFormat(String dateFormat) throws ConfigException
setFilePattern(String)
).
The date format should be a pattern as defined by
SimpleDateFormat
.
If a format is not specified, a default of "yyyy-MM-dd" is used.
dateFormat
- the date format to useConfigException
- if unable to set the date formatvoid setFileLimit(int limit) throws ConfigException
Specifies an approximate maximum amount to write (in bytes) to any one log file. If this is zero (the default), then there is no limit.
limit
- the file limit in bytes or 0 for no limitConfigException
- if unable to set the propertyvoid setFileAppend(boolean append) throws ConfigException
Specifies whether log records should be appended to existing log files. If false then files are overwritten.
If not specified then false is assumed.
append
- true to append, false to overwriteConfigException
- if unable to set the propertyvoid setFileCount(int fileCount) throws ConfigException
Specifies the number of log files to use. Must be at least 1.
If not specified then 1 is assumed.
fileCount
- the file countConfigException
- if unable to set the propertyint getFileCount()
LogDescription
getFileCount
in interface LogDescription
LogDescription.getFileCount()
@Deprecated void setRotateDaily(boolean rotateDaily) throws ConfigException
If not specified then false is assumed.
rotateDaily
- true if the log is to rotate on a daily basisConfigException
- if unable to set the propertyvoid setRotationPeriod(int period, TimeUnit unit) throws ConfigException
This method accepts an integer and a TimeUnit, specifying the duration a log file exists for, after which it will be rotated.
period
- the time period over which log files exist before rotationunit
- the TimeUnit defining the rotation periodConfigException
- if unable to set the propertyCopyright © 2016 Push Technology Ltd. All Rights Reserved.