This page documents all the properties that can be set to configure Simple Log.
Technically, you don't really need this page. Except for the system properties at the beginning, all the documentation here is found in the Simple Log configuration files.
Don't you think it makes more sense to have the documentation of the properties with the actual properties, rather than in the fourth page of the user guide.
Anyway, if you crave the comfortable lustre of HTML, this page is here for you, any time you need it. That's what friends are for.
Simple Log responds to the following System Properties, which can be defined either using the -D command line argument to your Java Virtual Machine, or by calling System.setProperty().
By default, Simple Log tries to load its configuration from a file called simplelog.properties which it looks for in the root of the classpath. The simplelog.configuration lets you tell it to look somewhere else. It can be used to load configuration either from the file system or from somewhere else on the classpath.
To load the configuration from the file system, the value of simplelog.configuration should be file: followed by either an absolute or relative path to the configuarion file. If a relative path is used, the path is interpreted relative to the working directory of the process (standard java.io.File behaviour).
Example: you to want load your properties from /etc/simple-log-shared.properties
-Dsimplelog.configuration=file:/etc/simple-log-shared.properties
To load the configuration from the classpath, the value of simplelog.configuration should be classpath: followed by a path specifing where to find the configuarion file relative to the root of the classpath.
Example: your properties are in WEB-INF/properties/secret-logging.properties in your web application
-Dsimplelog.configuration=classpath:WEB-INF/properties/secret-logging.properties
Setting this property to true will result in Simple Log itself outputting debugging information. This option is particularly useful if you find yourself in the scenario where Simple Log isn't creating any output and you think it should be. The output will be written to System.err and will look similar to the following example.
SimpleLog [dev.debug]: Simple Log DEV Debugging enabled (-Dsimplelog.dev.debug) SimpleLog [dev.debug]: Creating default SimpleLog instance SimpleLog [dev.debug]: System property 'simplelog.configuration': null SimpleLog [dev.debug]: Attempting to load default properties (simplelog.properties) from classpath SimpleLog [dev.debug]: SimpleLog [dev.debug]: FAILED to load any SimpleLog configuration. SimpleLog [dev.debug]: SimpleLog [dev.debug]: NO LOG OUTPUT WILL BE GENERATED.
Normally, if Simple Log encounters an internal error, it will print a message to System.err and, where necessary, the type and message exception that caused the error. Setting this property to true will cause the stack trace of the exceptions to also be printed in these circumstances.
Debug levels for classes and packages are defined simply by entering a fully-qualified class or package name and making the value either the number or name of one of Simple Log's DebugLevels. (Note that the '=' is optional in Java properties files).
When the name of a debug level is used:
The debug level for a class is acquired hierarchically: First the class name is sought, then its package, then its parent package, etc. If no level is found for a class or any of its containing packages, the default level is used.
Levels are defined as:
(see org.grlea.log.DebugLevel javadoc for details)
Example: if we wanted the following configuration:
org.grlea.application.ApplicationMain: Verbosethen we could use either the properties:
All other 'org.grlea.application' classes: Debug
All other 'org.grlea' classes: Error
OR the propertiesorg.grlea.application.ApplicationMain 6 org.grlea.application 5 org.grlea 2
org.grlea.application.ApplicationMain = verbose org.grlea.application = debug org.grlea = error
Debug levels and trace flags for inner classes can be specified using either the dollar sign ('$') that javac puts in the name or just the normal period ('.') that you use to access them in code.
If you are using instance loggers, you can specify levels for particular instances by appending to the class name a period ('.') and the string representation of the instance ID.
Example: To log the 'InstanceObject' instance with instance ID 'Special' at the Verbose level and all other InstanceObject instances at the Error level, you would write:
org.grlea.application.InstanceObject.Special = verbose org.grlea.application.InstanceObject = error
Tracing flags are set in the same manner as debug levels (you just need the fully-qualified class or package name and a value) except that:
#trace
' (without the quotes) must be appended to the class or package name; andtrue
or false
Example:
org.grlea.application.ApplicationMain#trace true org.grlea.application#trace false
Default level for classes for which no debug level hierarchy exists: Same values as for debug levels (1 to 7 or Fatal, Error, Warn, Info, Debug, Verbose or Ludicrous)
Default: 4
(Info)
Default tracing for classes for which no tracing hierarchy exists: true or false
Default: false
A comma-separated list of other properties files to import. The files must be in the classpath. This property only works when it is in the primary simplelog.properties file.
Note that if a property is specified in more than one file, its value will be sourced from the last file (in the list) that it appears in.
Default: simplelog-config.properties,simplelog-rollover.properties
Send log output to a file (rather than to System.err): relative or absolute file name.
If the interpretName
property is true (default), the file name will be interpreted using a
MessageFormat, with argument 0 being the current Date. This allows the date to be inserted into
the file name using patterns like {0,date,yyyy_MM_dd} or {0,date,yyyy} and {0,date,MM}, etc.
Note that the name will NOT be interpreted if log rolling is active.
Relative paths are relative to the JVM's working directory. Non-existing directories are created. Output falls back to System.err if the file name can't be interpreted or the file can't be opened for writing.
Default: blank (write to System.err)
Whether the logFile property should be interpreted using a MessageFormat: true or false See the description for simplelog.logFile above for more details.
This property has no effect when log rolling is in use. The log file name will not be translated.
Default: true
When writing log output to a file, append to the file if it already exists: true or false
This property has no effect when log rolling is in use. An existing active log file will always be appended.
Default: true
Whether the logging output going to a file should also be output to the console: true or false Only applies when simplelog.logFile is assigned.
Default: false
Reload the properties if they change: true or false
Default: false
Whether the exception message should print a stack trace: true or false
Default: true
Date format for ALL message formats: see java.text.SimpleDateFormat
Default: EEE yyyy/MM/dd HH:mm:ss.SSS
Message formats for each type of logging: see java.text.MessageFormat Note there is a different format for SimpleLoggers created on a per-instance basis.
The common message arguments are:
The uncommon message arguments are:
These are the default values for the formats for each non-instance message type.
simplelog.format.debug = {0}| |{1}|{2}|{5}
simplelog.format.debugObject = {0}|---|{1}|{2}|{5}|{6}
simplelog.format.debugException = {0}|***|{1}|{2}|{5}
simplelog.format.entry = {0}|>>>|{1}|{2}|{5}
simplelog.format.exit = {0}|<<<|{1}|{2}|{5}
These are the default values for the formats for each instance message type.
simplelog.format.debug.instance = {0}| |{1}|{2}[{3}]|{5}
simplelog.format.debugObject.instance = {0}|---|{1}|{2}[{3}]|{5}|{6}
simplelog.format.debugException.instance = {0}|***|{1}|{2}[{3}]|{5}
simplelog.format.entry.instance = {0}|>>>|{1}|{2}[{3}]|{5}
simplelog.format.exit.instance = {0}|<<<|{1}|{2}[{3}]|{5}
Enables the rolling of log files, using the specified strategy.
Valid values are 'fileSize
', which performs file size-based rollover, 'timeOfDay
', which performs
time-based rollover, or the name of any concrete implementation of
org.grlea.log.rollover.RolloverStrategy
.
Note that the RolloverStrategy implementation must contain a zero-argument constructor.
Default: blank (no rollover)
When rollover is in use, specifies the directory, either absolute or relative to the working directory, into which rolled-over log files should be moved. If this property is not specified, rolled-over log files will be stored in the same location as the active log file.
Default: blank (same directory as active log file)
When rollover is in use, specifies the format of the file name to use for rolloed-over log files.
The message arguments are:
If you should want to keep only one rolled-over log file (in addition to the active log), you may emit both variabes from the name (e.g. tomcat-rolled.log) and the file will be overwritten each time the active file is rolled.
Example:
Rollover Filename Pattern Example Results tomcat-{1}.log
tomcat-1A.log
tomcat-1B.logtomcat-{1}-{0,date,MMM_dd}.log
tomcat-1A-Oct_24.log
tomcat-1B-Oct_25.log
Default: {1}-<active log file pattern>
Specifies how often the rollover strategy will be consulted to decide whether to roll or not. Must be a positive integer in seconds.
Default: 60
When 'fileSize
' rollover is in use, specifies the size at which log files should be rolled.
Must be a positive integer followed by 'b' (bytes), 'K' (kilobytes), 'M' (megabytes), 'G'
(gigabytes) or 'T' (terabytes).
Default: 100M
When 'timeOfDay
' rollover is in use, specifies the time of the day at which the logs should roll
over. The value should be in hours and minutes, separated by a colon, e.g. 23:30 specifies half an
hour past 11 PM.
Default: 0:00
(12 midnight)
When 'timeOfDay
' rollover is in use, specifies the TimeZone in which the rollover time
(simplelog.rollover.timeOfDay.time) is specified.
The value should be any TimeZone ID accepted by java.util.TimeZone.getTimeZone(String id)
This property can be used to set the rollover time based on a TimeZone other than that in which the process is running. This relinquishes the need to perform time difference calculations or to make changes as daylight savings times begin and end.
Because on some systems it may be difficult to set the default TimeZone properly, it is recommended that you always set this property, even when the default TimeZone is desired.
Default: blank (Uses the system's default TimeZone)
Copyright (c) 2006-2015 Graham Lea. All rights reserved.