Skip navigation
Currently Being Moderated

Help with CF8 CFLOG oddity?

Jun 14, 2011 12:40 PM

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

 
Replies
  • Currently Being Moderated
    Jun 16, 2011 6:55 AM   in reply to cf_ron

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2011 7:09 AM   in reply to BKBK

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2011 7:30 AM   in reply to Adam Cameron.
    function(){return A.apply(null,[this].concat($A(arguments)))}

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2011 8:33 AM   in reply to cf_ron

    Oh, I wasn't suggesting there was anything wrong with you code, I was replying to BKBK and just putting them straight on CFLOG usage.

     

    As for your own problem, I have no idea what might be going on, so have nothing to add in that regard.

     

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2011 6:25 AM   in reply to cf_ron

    Although you shouldn't have used file="application", I still find it rather strange that ColdFusion would eject stuff from your application.log file. Are you sure it's the same file?

     

    In other words, are you sure ColdFusion is deleting archived log messages before writing a new message to the same file? Or, could it be that, with file="application", ColdFusion creates a new application.log file, as it is instructed to, and simply replaces the existing application.log file with it?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2011 6:37 AM   in reply to cf_ron
    function(){return A.apply(null,[this].concat($A(arguments)))}

    cf_ron wrote:


    We can certainly change the logic to ensure consistency (FILE for non-standard logs, LOG for standard) but that involves changing code in hundreds of files in several different applications to work around behavior on just one of the servers... something we're trying stay away from.

    I think it's worth the effort to correct it. You cannot afford going without application log messages.

     

    Don't underestimate your own human ingenuity. I thought like you when faced with several dozen changes in hundreds of files. However, unlike you, I had a deadline and no choice.

     

    I can tell you that, once you get going, solutions come quicker and quicker. Start with the obvious: the extended search/replace mechanism in Eclipse. You could be through in an hour or two!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points