ColdFusion Muse

Why is my Jrun Error Log So Big?

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">
      <attribute name="filename">{jrun.rootdir}/logs/{jrun.server.name}-event.log</attribute>
<attribute name="rotationSize">200k</attribute>
<attribute name="rotationFiles">3</attribute>
<attribute name="closeDelay">5000</attribute>
<attribute name="deleteOnExit">false</attribute>
</service>
</service>
</service>

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:

<attribute name="filename">{jrun.rootdir}/logs/{jrun.server.name}-event.log</attribute>
...to this...
<attribute name="filename">{jrun.rootdir}/logs/{jrun.server.name}-{log.level}.log</attribute>
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.

  • Share:

14 Comments

  • Douglas Knudsen's Gravatar
    Posted By
    Douglas Knudsen | 1/3/06 8:35 PM
    except this doesn't work for the <servername>-out.log file. Unless you know of a way?
  • mkruger's Gravatar
    Posted By
    mkruger | 1/4/06 7:56 AM
    yeah - I neglected to mention that. For some reason the -out file is not affected. I'm not sure why. Let me try and find out.
  • Rich's Gravatar
    Posted By
    Rich | 2/20/06 6:18 AM
    Hi

    any idea how to change the server-out file yet?

    getting 1gb log files :(
  • Jason Chapin's Gravatar
    Posted By
    Jason Chapin | 3/28/06 3:35 PM
    FYI - In my CF 6.1 installation (w2k), the jrun.xml file was located at CFusionMX\runtime\servers\default\SERVER-INF\ .
  • mkruger's Gravatar
    Posted By
    mkruger | 3/28/06 3:41 PM
    Thanks - looks like an oversite.
  • Douglas Knudsen's Gravatar
    Posted By
    Douglas Knudsen | 3/28/06 8:00 PM
    I worked with a Adobe support perosn recently and was told there is nothing that can be done with the <servername>-out.log and <servername>-err.log files.

    DK
  • dina's Gravatar
    Posted By
    dina | 11/7/06 5:41 AM
    will this work with CF MX5? there seem to be absolutely no log rolling in this version

    thanks
  • dina's Gravatar
    Posted By
    dina | 11/7/06 7:10 AM
    even I could not see jrun.xml in the server
  • mkruger's Gravatar
    Posted By
    mkruger | 11/7/06 8:08 AM
    There is no jrun.xml on a cf 5 server because it was written in C++ so there is no Java Runtime. There are no options (that I know of) to roll logs in CF 5. I'm afraid you are out of luck there.
  • dina's Gravatar
    Posted By
    dina | 11/8/06 8:39 AM
    do you think theres a way where we can script something in batch files to archive logs and restart CF
  • Noah's Gravatar
    Posted By
    Noah | 7/12/07 2:18 PM
    I recently inherited control of a CF 6.1 server and discovered this same problem (a log of over 2 years totaling 2.6 GB). I followed the steps provided, and it is generating the new error files, but it is also *still* creating a single, unlimited error file.

    I have default-err.log, which is growing obscenely fast (1MB in a matter of hours), and I also have:

    default-error.log
    default-error_1.log
    default-error_2.log
    default-error_3.log

    Note "error" instead of "err". Why am I getting both? I want to post my sea of error messages, but that's a bit off-topic.
  • Charlie Arehart's Gravatar
    Posted By
    Charlie Arehart | 11/18/07 7:58 PM
    To those observing that CF 7 let's the -error and -out logs grow unchecked, that's fixed in a hotfix discussed at http://www.adobe.com/go/8698aeb8.
  • Flunk's Gravatar
    Posted By
    Flunk | 12/6/07 2:23 PM
    ColdFusion 6.1 should never have come out of beta. My job seems to consist of dealing with ColdFusion 6.1's shortcomings.

    The only thing more beta than ColdFusion 6.1 is my employer who has cluelessly remained with this piece of garbage for so long.
  • Charlie Arehart's Gravatar
    Posted By
    Charlie Arehart | 12/6/07 3:59 PM
    Yeah, and that Frasier show. Man, when will that ever go off the air? Haven't people had enough?...

    Um, Flunk, wake up. 6.1 came out in 2004. And actually, it was an update to 6.0, which was itself the major upgrade over CF5. Now, a lot of people had issues that that move from 4 or 5 to 6, but 6.1 itself shouldn't seem a problem.

    Anyway, if your major job involves overcoming issues with CF, then it seems CF is important enough that you guys ought to have updated to 7 (now almost 3 years old), or 8 (now 4 months old). Are you at least running the free updater to 6.1, from Aug 2004? You may do yourself a favor with that. (Check your Admin to see if your version is at least 6,1,0,83762.)

    But what other problems are you facing? Perhaps we can help. (I don't think Mark would mind having that discussion here.)