Skip to content

Logging

TechieGuy12 edited this page Jul 12, 2024 · 7 revisions

Any messages or errors that happen within File Watcher are written to a log file. If you would like to provide more specific information about the log file, you can specify it in the configuration file using the <logging> element within the <watches> element.

Elements

Element Description
path (Optional) The full path to the log file. Default %TEMP%\fw.log.
size (Optional) The maximum size of the log file in megabytes before the log file is rolled over to a new file. Default: 5.
number (Optional) The number of log files to retain. Default: 10.
level (Optional) (Version 2.x or higher.) The level of logging to include. Default: INFO.

All the elements listed above are optional, and if no logging elements are specified, the <logging> element can be omitted entirely from the configuration file.

Level

Note

Log level is available in version 2.x and higher.

To control how much information is displayed in the log, the <level> element can be set to one of the following values:

Attribute Description
DEBUG All debugging information.
INFO (Default) Any information messages.
WARNING Any warning messages.
ERROR Any error message.
FATAL Any fatal messages that stop FileWatch from running.

Note

The above values are case-sensitive, so they will need to be added to the configuration file as shown above.

Information for all higher log levels are also displayed. For example, if the log level is set to WARNING then all messages then all error and fatal messages are displayed, but debug and information messages are not displayed.

Examples

Create the log file in C:\Temp\filewatcher.log:

<watches>
    <logging>
        <path>C:\Temp\filewatcher.log</path>
    </logging>
</watches>

Create the log file in C:\Temp\filewatcher.log, and limit the log file to 2 MB:

<watches>
    <logging>
        <path>C:\Temp\filewatcher.log</path>
        <size>2</size>
    </logging>
</watches>

Create the log file in C:\Temp\filewatcher.log, limit the log file to 2 MB, and retain 5 log files:

<watches>
    <logging>
        <path>C:\Temp\filewatcher.log</path>
        <size>2</size>
        <number>5</number>
    </logging>
</watches>
Clone this wiki locally