Search code examples
javacoldfusionwindows-servicesjrun

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


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).


Solution

  • 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.