writeLog
Writes a message to a log file.
writeLog(text [, type] [, application] [, file] [, log] ) → returns void
Argument Reference
text string Required
Message to log. The date / time will be logged automatically for you.
type string
Type or severity of the log message
Values:
informationwarningerrorfatal
application boolean
Default: true
true
Logs the application name, if it is specified in Application.cfc or a cfapplication tag.
file string
log string
If you omit the file attribute, writes messages to standard log file. Ignored, if you specify file attribute. Application: writes to Application.log, normally used for application-specific messages. Scheduler: writes to Scheduler.log, normally used to log the execution of scheduled tasks.
Values:
ApplicationScheduler
Compatibility
Lucee:
In Lucee 6.2 or later the default log level is ERROR, so no messages will appear in the logfile unless you have specified type=error or type=fatal. You can change the default as discussed here: https://dev.lucee.org/t/application-log-defaults-to-error-in-6-2/14773
Examples Sample code invoking the writeLog function
Logs an order processed successfully message to orders.log which will be located in the CF logs directory, eg: {cf.root}/cfusion/logs/
writeLog(text="Order #order.getOrderID()# Processed Successfully", type="information", file="orders");
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/writelog