Skip to main content
Inspiring
June 14, 2011
Question

Help with CF8 CFLOG oddity?

  • June 14, 2011
  • 1 reply
  • 1451 views

I have encountered an oddity with calls to CFLOG on one of our CF8-based production servers that is repeatable on that system but not repeatable on a CF8 dev server, a CF9 dev server, or a CF9 production server: we have code that periodically invokes CFLOG with LOG="application" and TYPE="information" attributes (e.g., in the application.cfc's onApplicationStart and onApplicationEnd methods). This is going to sound crazy, but any such log entries are eliminated by the next CFLOG invocation with a FILE="application" attribute.

I stumbled on to this as we were trying to troubleshoot some issues associated with application initialization on this particular server: we added the CFLOG LOG="application"... calls and I started watching the logs to see what was going on. Eventually, we had enough diagnostic information that I had figured out what was going on. When I checked the application.log file the next day, those entries were no longer present... I could see entries before and after those entries, but they were gone. I downloaded the log file and verified that they were in fact not present and weren't just being omitted by the log file viewer within the CFAdmin interface. Definitely not present. I reinitialized the application and verified that our informational log entries were there; checked again this morning... gone. Apparently overwritten by the next error being thrown, caught, and logged. Interestingly, our error logging uses CFLOG FILE="application".

I have verified this behavior with some test code on this particular server: if I call CFLOG log="application" and then check the log file, that new entry is present. As soon as I turn around and call CFLOG FILE="application", that first entry (and anything after it, regardless of how it got there!) is clobbered and the message from that CFLOG FILE="application" is the last entry in the log (both via the CFAdmin interface and in the downloaded application.log file).

I have another CF8 box (both running at CHF 4) that does not exhibit this behavior, nor can I get this to happen on any of our other various CF servers. Based on a note from Charlie Arehart on CFLOG reference page, I checked the coldfusion-out.log... and those entries that end up being clobbered from application.log ARE present in the coldfusion-out.log file on the server exhibiting this behavior.

Anyone have any sort of a clue as to what is going on here and how to solve it? It's particularly troubling to have stuff be logged only to disappear from the log files, and for whatever reason it appears that there is some sort of odd interaction between the LOG="application" and FILE="application" attributes on different invocations of the CFLOG tag.

Thanks. (And really, I'm neither crazy -- at least not REALLY crazy -- nor making this up!)

--

/ron

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    June 16, 2011

    It is an oddity indeed. But so too is your code.

    If you wish to log to the file Application.log, then the code to use is

    <CFLOG FILE="application" TYPE="information"> or <CFLOG TYPE="information">

    That is, you're meant to use the file attribute to specify which standard log ColdFusion should write to. The log attribute is meant for you to use to specify your own custom file name. In other words, you shouldn't be using LOG="application" in any case.

    Inspiring
    June 16, 2011

    It's the other way round, mate.

    Use FILE to specify a custom log or LOG to specify a standard one, eg:

    <cflog log="application" text="Goes to CF's standard application.log">

    or:

    <cflog file="adam" text="Goes to adam.log">

    --

    Adam

    BKBK
    Community Expert
    Community Expert
    June 16, 2011

    Adam Cameron. wrote:

    It's the other way round, mate.

    Indeed. Thanks, Adam. I mistakenly wrote 'log' and 'file' the other way round! My post should have read:

    It is an oddity indeed. But so too is your code.

    If you wish to log to the file Application.log, then the code to use is

    <CFLOG LOG="application" TYPE="information"> or <CFLOG TYPE="information">

    That is, you're meant to use the log attribute to specify which standard log ColdFusion should write to. The file attribute is meant for you to use to specify your own custom file name. In other words, you shouldn't be using FILE="application" in any case.