The following properties of the FormattingFileLogger
component enable you to control how you name the log files:
Property | Type | Function |
---|---|---|
| string | Specifies the directory where log files are written, relative to Example: |
| string | Specifies the first element of the log’s file name. Example: |
| string | Specifies the file extension (such as Example: |
| Boolean | If set to |
| string | Specifies the date format to use in file name timestamps. Example: |
For example, the following property settings yields 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.
In the timestampDateFormat
, avoid using separator characters that result in invalid file names in your operating system. For example, if you set:
timestampDateFormat=yyyy-MM-dd_HH:mm:ss
the resulting log file name is like this:
userevents_02-09-2001_18:36:03.data
Because the colon ( :
) is not a valid character in Windows file names, this yields 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.