Bugzilla – Bug 4246
Winsw creates unmanaged stdout and stderr logs
Last modified: 2011-10-27 17:57:47 UTC
When I install glassfish v3.1 as a windows service via
asadmin create-service --name name domain_name (winsw)
two unmanaged logfiles are created in glassfisn3/glassfish/domains/domain_name/bin/, called servcieName.err.log and serviceName.out.log.
There is currently no method to tell winsw to not create the stdout/stderr log files. They only seem to be managed on start up of the service. If the service is up and running for a long time these files can get very big. For glassfish v3.1, what we need , is a way to tell the service to not write ANYTHING to those log files. It is just a duplicate of what's going into the server log anyways.
BTW I configured the <logmode> to rotate and the files seem to continue to grow.
reset mode only takes place on service start-up.
Originally discussed on www.java.net forums
I just noticed that the <logmode>rotate is invalid. I changed the mode to "roll" and restarted the service. The log file was rolled to .old. If the number of ".old" files are limited, I'm all set.
It looks like the roll logmode only works at service start-up also :(
Created attachment 480 [details]
Proposed patch for bug 4246
I am not a winsw developer, but I made the following changes to Main.cs in order to meet the needs of my current project involving Glassfish 3.0 and JavaDB.
- Expand environment variables for xml node "//logpath"
- Try / catch around "//stopexecutable" xml node lookup. Don't crash when non-existent
- Limit log file size based on new xml node "//logfilemaxsize". After this size reached, log files are either rotated (Logmode rotate), or further output is not captured to file (end thread CopyStream(..))
Created attachment 508 [details]
Addition of more log appenders
In a similar vein to the previous patch, but replaces the existing logmode with logAppenders.
The following appenders are supported:
Default - behaves the same as logmode = default
Used when no logAppender is specified
Reset - behaves the same as logmode = reset
Rolling - behaves the same as logmode = roll
SizeBasedRolling - configurable size and number of files to keep
<sizeThreshold>1</sizeThreshold> <-- in kB -->
<keepFiles>2</keepFiles> <!-- number of files to keep when rolling over -->
TimeBasedRolling - pattern time based rolling
<pattern>yyyy-MM-dd_HH-mm-ss</pattern> <!-- time format to use -->
<period>120</period> <!-- how often to roll over - based upon smallest unit of time from the pattern. In this example, it would roll every 120 seconds. -->
My patch also adds an attribute to the argument tag, qws (quote whitespace), which allows for overrides of the default to quote whitespace.
Applied the patch with some changes. Note that the code is moved to GitHub: http://github.com/kohsuke/winsw