From 0c369c317d257dc0aaa691a6b389efae78e632fa Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Fri, 1 Mar 2013 18:31:32 -0800 Subject: [PATCH] Added logging --- README.markdown | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 4a1c590..84e60f9 100644 --- a/README.markdown +++ b/README.markdown @@ -61,6 +61,42 @@ The success or failure of these operations will be recorded in the event log. The `` element in the configuration file also provides an useful building block for a self updating services. +Logging +------- +Winsw supports several different ways to capture stdout and stderr from the process you launch. + +### Log directory +The `` element specifies the directory in which the log files are created. If this element is absent, it'll default to the same directory where the configuration file resides. + +### Append mode (default) +In this mode, `myapp.out.log` nad `myapp.err.log` (where `myapp` is the base name of the executable and the configuration file) are created and outputs are simply appended to these files. Note that the file can get quite big. + + + +### Reset mode +Works like the append mode, except that every time the service starts, the old log files are truncated. + + + +### Rotate mode +Works like the append mode, but in addition, if the log file gets bigger than a set size, it gets rotated to `myapp.1.out.log`, `myapp.2.out.log` and so on. The nested `` element specifies the rotation threshold in KB (defaults to 10MB), and the nested `` element specifies the number of rotated files to keep (defaults to 8.) + + + 10240 + 8 + + +### Rotate by time mode +Works like the rotate mode, except that instead of using the size as a threshold, use the time period as the threshold. + +This configuration must accompany a nested `` element, which specifies the timestamp pattern used as the log file name. + + + yyyyMMdd + + +The syntax of the pattern string is specified by [DateTime.ToString()](http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx). For example, in the above example, the log of Jan 1, 2013 gets written to `myapp.20130101.out.log` and `myapp.20130101.err.log`. + Configuration file syntax ------------------------- @@ -134,5 +170,6 @@ This optional element can be specified multiple times to have the service wrappe This is another useful building block for developing a self-updating service. - +### log +See the "Logging" section above for more details.