JRun/Coldfusion - System.out - how to prevent it getting too large?
Asked Answered
I

1

7

I am running ColdFusion 8 application servers on Windows machines. ColdFusion is running as a Windows service.

I have noticed that System.out file is massive (1GB+) on some of the machines.

e.g.

C:\ColdFusion8\runtime\bin\System.out

I understand this is where console output ends up when running CF as a service, but is there any JRun setting to allow me to save this file off every x MB, or to limit the size of the file or something similar?

All tips appreciated!

IMPORTANT EDIT:

Based on a discussion here - I thought it important to mention that the System.out file has gotten large on our machines due to lots of code writing to that file, i.e. using:

sys = createObject("java", "java.lang.System");
sys.out.println(...);

If you are running CF as a console job (i.e from the command line) this is a useful debugging tool, as older versions of CF did not not log to console when using <cflog />.

We've asked our developers to discontinue this practice and instead use <cflog /> or writeLog() both of which log to the console as well as the the application log (by default).

Indefatigable answered 24/2, 2010 at 17:18 Comment(0)
M
8

It looks like if you go to the jrun.xml for your ColdFusion server file and find the line:

<service class="jrunx.logger.ConsoleLogEventHandler" name=":service=ConsoleLogEventHandler" />

You should be able to add these bits to it:

    <attribute name="rotationSize">200k</attribute>
    <attribute name="rotationFiles">3</attribute>
    <!-- Use heading to specify an alternate log heading for system event log. -->
    <!-- EXAMPLE: <attribute name="heading"># Created by JRun on {date MM/dd HH:mm:ss}</attribute> -->
    <attribute name="closeDelay">5000</attribute>
    <attribute name="deleteOnExit">false</attribute>

And then manipulate the settings as you see fit. However according to this blog entry, you cannot change the name of the file.

Mahon answered 25/2, 2010 at 4:48 Comment(3)
There is actually one <service /> XML node in there already for the Coldfusion log files, and you can add another <service /> node with a unique name and point it at {jrun.rootdir}/bin/System.out to sort out that file - works a charm!Indefatigable
There is another way to do this: run some CF code within your application to overwrite the file as required. This works but it seems to prevent CF appending to it after that. Might not suit everyone.Indefatigable
Please see the comments here: carehart.org/blog/client/index.cfm/2010/10/15/… for a fuller discussion on this - the upshot is stop using System.out.println() and use <cflog> or writeLog() instead.Indefatigable

© 2022 - 2024 — McMap. All rights reserved.