<cflog>

Writes a message to a log file.

This tag cannot have a body.

This tag is also supported within <cfscript>

<cflog text=string exception=any charset=string log=string file=string async=boolean type=string thread=boolean date=boolean time=boolean application=boolean >
Attribute Description
text
string, optional

The message to log

Alias: message

exception
any, optional

An exception to log

charset
string, optional

Character set name for the file contents.

log
string, optional

Specifies the log to which to write the message. This reference can be defined in the Lucee Administrator. Ignored if you specify a file attribute.

Alias: name

async
boolean, optional

only works in combination with the attribute "file", if set to true the file is written in a separate thread.

Alias: spoolenable

type
string, optional

the following is the log type (level) in decreasing order of severity:

  • fatal: Severe errors that cause premature termination.
  • error: Other runtime errors or unexpected conditions.
  • warn,warning: Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong".
  • info,information (default): Interesting runtime events.
  • debug: Detailed information on the flow through the system.
  • trace: Most detailed information.

Alias: level

application
boolean, optional

Specifies whether to log the application name if one has been specified in a cfapplication tag.

Unimplemented Attribute(s)

Attribute Description
file
string, optional

Define instead a log reference in the Lucee Administrator and use the name of the generated log with the attribute log. Specify only the main part of the filename. For example, to log to the Testing.log file, specify "Testing". The file must be located in the default log directory. You cannot specify a directory path. If the file does not exist, it is created automatically, with the suffix .log.

* deprecated *
thread
boolean, optional

This attribute has been deprecated and is non-functional.

* deprecated *
date
boolean, optional

This attribute has been deprecated and is non-functional.

* deprecated *
time
boolean, optional

This attribute has been deprecated and is non-functional.

* deprecated *

Usage Notes

For better performance, always use the log attribute with the name of a log which is either defined in the admin, or via Application.cfc / <cfapplication> this.logs

The file attribute is deprecated but still works, however, the file connection isn't cached, and will be slower than using a predefined log

Examples

Format for cflog

<cflog text="Good things come in good times" log="myfile" type="information">

See also