The following properties of the FormattingFileLogger
component enable you to control how you name the log files:
Property Name | Property Type | Function | Example |
---|---|---|---|
| string | specifies the directory in which to write log files, relative to |
|
| string | specifies the first element of the log’s file name |
|
| string | specifies the file extension (such as |
|
| Boolean | if set to | |
| string | specifies the date format to use in file name timestamps |
|
For example, the following property settings would result in log file names like userevents_02-09-2001_18-36-03-55.data
:
logFileName=userevents_
logFileExtension=data
timestampLogFileName=true
timestampDateFormat=MM-dd-yyyy_HH-mm-ss-SS
Using timestamps in your log file names ensures that log files have unique names and are preserved on application restarts.
Note that in the timestampDateFormat
, you should avoid using separator characters that would result in invalid file names in your operating system. For example, if you set:
timestampDateFormat=yyyy-MM-dd_HH:mm:ss
then the resulting log file name would be like this:
userevents_02-09-2001_18:36:03.data
Since the colon ( :
) is not a valid character in Windows file names, this would result in errors on a Windows platform.
The schedule
and scheduler
properties of the FormattingFileLogger
determine when a log file is closed and a new log created with a new name.