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

Ciaran Archer
  • 12,316
  • 9
  • 38
  • 55

1 Answers1

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.

Adam Tuttle
  • 19,505
  • 17
  • 80
  • 113
Terry Ryan
  • 1,911
  • 15
  • 13
  • There is actually one XML node in there already for the Coldfusion log files, and you can add another node with a unique name and point it at {jrun.rootdir}/bin/System.out to sort out that file - works a charm! – Ciaran Archer Feb 26 '10 at 10:33
  • 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. – Ciaran Archer Mar 03 '11 at 13:50
  • Please see the comments here: http://www.carehart.org/blog/client/index.cfm/2010/10/15/controlling_size_of_CF_out_logs for a fuller discussion on this - the upshot is stop using `System.out.println()` and use `` or `writeLog()` instead. – Ciaran Archer Mar 14 '11 at 15:13