CF Muse Reader Asks:
On our CF 6.1 server, we have a /CFusionMX/runtime/logs/default-err.log file that is over 100MB in size. Is there a good way to knock that down, or is it okay to just delete the thing?
First things first, yes it is fine to delete this file. Make sure you know why it is growing so large - there may be errors you should be concerned about, and this file merits your review. In order to delte the file you will have to stop coldfusion. Upon a restarting Coldfusion will actually recreate the file starting with a nice tidy 1 kilobyte. You might notice that the "event" log actually "rolls over" every 200k. Wouldn't it be nice if the err log did that too? It can...
There are additional parameters that are configurable for the Jrun logs. The default installation only specifies these parameters for the event log. Why? Because of a simple flaw in the Jrun.xml file. Look in the Jrun.xml file (found in cfusionmx/runtime/bin). You will see a section like the following:
<service class="jrunx.logger.LoggerService" name="LoggerService">
.... bunch of attributes...
<service class="jrunx.logger.ThreadedLogEventHandler" name="ThreadedLogEventHandler">
<service class="jrunx.logger.ConsoleLogEventHandler" name=":service=ConsoleLogEventHandler" />
<service class="jrunx.logger.FileLogEventHandler" name="FileLogEventHandler">
Notice that the "FileLogEventHandler" has some extra attributes. One of them is a file name attribute. Which is "hard coded" to be the server name plus "-event.log". Because this group of attributes is specified to only apply to the "-event" log, the attribute "rotationSize" is only ever checked for that file. However, if you change this line:
It will have the effect of applying the rotation size to all the log files in the log log directory. A side effect or consequence of this action is that all the possible "log level" events are broken out into different files - so you end up with a -user.log, -err.log, -info.log, -warning.log and a -out.log. You can even create your own logger if you know how to manipulate the logger service.
Since the -err log and -out log now "rollover" there is no need to stop the service. You can clean out the directory by deleting old log files that are no longer open. They will exist with an "_1" or "_2" etc. in the name.
See this Macromedia Technote for more information.