Warning about ColdFusion 10 and ORM Logging

This post is more than 2 years old.

First off, credit for this post belongs to multiple people. This post stems from a discussion on a private listserv of ColdFusion developers. I'll make a list of folks at the end, but in this case, I'm mainly serving as the 'errand boy' to report the issue and help spread the word. I'll do my best to describe the issue accurately but any screw up is entirely my fault.

In ColdFusion 9 (and in the docs for ColdFusion 10 but not actually implemented), the log settings for ORM (as set in cfhome\lib\log4j.properties) is:

log4j.appender.HIBERNATECONSOLE=org.apache.log4j.ConsoleAppender

This means ORM-related messages are logged to the console. But in ColdFusion 10, this switched to:

log4j.appender.HIBERNATECONSOLE= org.apache.log4j.FileAppender

Another issue is that in ColdFusion 9, these two settings...

log4j.appender.HIBERNATECONSOLE.MaxFileSize=500KB
log4j.appender.HIBERNATECONSOLE.MaxBackupIndex=3

are commented out. You can probably guess what the result is - a (potentially!) huge ass log file. Most likely you want to change to a rolling file appender as described here: ColdFusion ORM : How to log SQL.

If you use ORM, I'd recommend checking your logs now and updating your settings as well.

Credit: Sam Farmer, Phill Nacelli, and anyone else I forgot.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by John Bliss posted on 1/18/2014 at 3:40 AM

> a private listserv of ColdFusion developers

Details? How private?

Comment 2 by Andrew Scott posted on 1/18/2014 at 9:13 AM

But I have one question, is there any reason why these settings can not also be set at the application layer as well. For example shared hosting and those who run multiple sites for their clients, could benefit from the ability to just switch on the logging for that application only as well as where to store these log files.

Comment 3 by Sumit Verma posted on 1/18/2014 at 10:08 AM

Ya, I got bitten by it few time. Do you know if there is an ER already logged for this for CF 11?

Comment 4 by Ryan Guill posted on 1/18/2014 at 6:51 PM

Yeah, we have been bitten as well. On one server it got to > 70gb before we discovered it, and on another we forgot to turn that setting off when we went to production on a legacy server without a lot of disk space and didn't remember until it had filled the disk up with > 100gb in that one file.

I agree as well that the application level setting should control it, or at very least have an admin level setting.

If someone discovers or creates an ER let me know, I would like to vote for it.

Comment 5 by Raymond Camden posted on 1/18/2014 at 8:02 PM

@john: Sorry, I can't.
@andrew: I agree. :)
@Sumit: Yes - it should already be corrected in 11.

Comment 6 by Adam Cameron posted on 1/19/2014 at 2:50 AM

John, Ray's almost certainly talking about the ColdFusion 11 Pre-Release programme. People on it like to be secretive about their membership of it despite there being no reason to be (it's *not* part of the NDA they... and I... all signed).

What they *can't* repeat is the discussions that go on there. I can only presume Ray got special sanction to raise this here. Otherwise this blog post *would* be breaking the NDA...

--
Adam

Comment 7 by Andrew Scott posted on 1/19/2014 at 4:24 AM
Comment 8 by Raymond Camden posted on 1/19/2014 at 7:39 AM

Adam, it really wasn't relevant - that's why I didn't specify the listserv. It wasn't part of me trying to be secretive - it just didn't matter.

Andrew, thanks - voting it up now.

Comment 9 by Andrew Scott posted on 1/19/2014 at 8:15 AM

No problem Ray, I am just surprised something like this has not been raised before.

On a side note, while talking about ORM & Logging... Does anyone have any actual stats, to show how much overhead logging can add to the request?

I am trying to gauge how slow is too slow, when it comes to CF-ORM.

Comment 10 by Pat Branley posted on 1/20/2014 at 4:35 AM

Another 'problem'

log4j.appender.HIBERNATECONSOLE.File=/opt/coldfusion10/cfusion/logs/hibernatesql.log

so this means its logging to the default instances log folder. However, if you are running multi instance CF10, then this is logging to the wrong instance folder.

Comment 11 by Sam Farmer posted on 1/20/2014 at 6:51 PM

Thanks for posting Ray (my blog has retired). Though I thought the first rule of fight club was...etc, etc.

Adam, Andrew: There is a bug out there for this:
https://bugbase.adobe.com/i...