<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
|
edit
The message to log Alias: message |
exception
any, optional
|
edit
An exception to log |
charset
string, optional
|
edit
Character set name for the file contents. |
log
string, optional
|
edit
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
|
edit
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
|
edit
the following is the log type (level) in decreasing order of severity:
Alias: level |
application
boolean, optional
|
edit
Specifies whether to log the application name if one has been specified in a cfapplication tag. |
Unimplemented Attribute(s)
| Attribute | Description |
|---|---|
file
string,
optional
|
edit
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
|
edit
This attribute has been deprecated and is non-functional. * deprecated * |
date
boolean,
optional
|
edit
This attribute has been deprecated and is non-functional. * deprecated * |
time
boolean,
optional
|
edit
This attribute has been deprecated and is non-functional. * deprecated * |
Usage Notes
editFor 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
editFormat for cflog
<cflog text="Good things come in good times" log="myfile" type="information">
See also
- Debugging
- Console logging using SystemOutput
- WriteLog()
- Logging
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)