BUG : when using <cflog> tag

When using the following code in a CFM file.
The log message is NOT written the correct file.

<cfset logFileName = "myLogFile">
    type = "Information"
    file = logFileName
    text = "This is my log message"

Expected : “This is my log message” is written to a file named, myLogFile.log
Actual : the message is written to logFileName.log

The expected “swap” of the variable name - works as expected in cfscript.

Don’t forget to tell us about your stack!

OS: AWS Linux 2 (CentOS)
Java Version: 11.Latest
Tomcat Version: 9.Something
Lucee Version:

That is not how CFML tags have ever worked. If one wants to use a dynamic value in a tag attribute value, one needs to explicitly indicate as such with # characters. Otherwise it’s a string literal (which is why your code doesn’t do what you want it to do).

In your case the tag should be:

    type = "Information"
    file = "#logFileName#"
    text = "This is my log message"

(NB: just as with your <cfset>, there is no need for the / in <cflog> either. The ill-reasoned “let’s pretend CFML is XHTML” fad went west about the same time XHTML did…).


Thanks @AdamCameron

I don’t, usually, use tags…
This came about in some really old code (and stable - never edited code) - that is still used - but has never been re-written into cfscript.

I’ll keep it in mind;
“No unquoted values in a tag attribute.”

As for the self-closing tag…
Habit from all the XML we use.

Thanks again for your help - glad it isn’t a bug!

I just found an option in the Lucee Administrator for providing the experience I inititally expected;

In Language/Compiler, is:
Tag attribute values

Handle unquoted tag attribute values as strings.

The value from attribute “subject” is not quoted, in that case if enabled the string “sub” submitted to the tag, if not enabled Lucee looks for a variable “sub”.