View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cflog PreviousNext

cflog

Writes a message to a log file.

Data output tags

<cflog 
text = "text"
log = "log type"
file = "filename"
type = "message type"
application = "application name yes or no">

cfcol, cfcontent, cfoutput, cftable

ColdFusion MX: Deprecated the thread, date, and time attributes. They might not work, and might cause an error, in later releases. (In earlier releases, these attributes determined whether the respective data items were output to the log. In ColdFusion MX, this data is always output.)

Attribute

Req/Opt

Default

Description

text

Required

 

Message text to log.

log

Optional

 

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.

file

Optional

 

Message file. 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.

type

Optional

Information

Type (severity) of the message:

  • Information
  • Warning
  • Error
  • Fatal Information

application

Optional

Yes

  • Yes: log application name, if it is specified in a cfapplication tag.
  • No

This tag logs custom messages to standard or custom log files. You can specify a file for the log message or send messages to the default application or scheduler log. The log message can include ColdFusion expressions. Log files must have the suffix .log and must be located in the ColdFusion log directory.

Log entries are written as comma-delimited lists with these fields:

Values are enclosed in double quotation marks. If you specify No for the application attribute, the corresponding entry in the list is empty.

You can disable cflog tag execution. For more information, see the ColdFusion Administrator, Basic Security page.

The following example logs the name of a user that logs on an application. The message is logged to the file myAppLog.log in the ColdFusion log directory. It includes the date, time, and thread ID, but not the application name.

<Cflog file="myAppLog" application="No"
   text="User #Form.username# logged on.">

For example, if a user enters "Sang Thornfield" in a form's username field, this entry is added to the myApplog.log file entry:

"Information","153","02/28/01","14:53:40",,"User Sang Thornfield logged on."


Contents > CFML Reference > ColdFusion Tags > cflog PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


Dave_ABS said on Dec 3, 2003 at 4:32 AM :
Hi,

I'm using cflog with MX6.1. I have an issue with it's functionality over previous versions. This extends to the functionality of MX created logfiles as well as the ones I create.

My issue is this: CFLOG in any prior versions CF would "release" the file after it had written it. CFMX does not - it locks the file and this means that you can't delete files written with CFLOG until you stop CFMX App server. I'm also concerned that if you have many log files, cold fusion has to keep a handle on them all - which is gonna use up memory. Would it not be better to release the file after it has been written to? don't want to have to stop my production server just becase I want to clear out a log file after I have corrected a problem the log file has recorded.

Thanks

David Hazell
jrunrandy said on Dec 4, 2003 at 10:44 AM :
This is a bug. We've entered it into the system as bug 53829. Thanks for the tip.
spage said on Mar 22, 2004 at 9:58 PM :
The docs say the possible values for the type attribute are:
* Information
* Warning
* Error
* Fatal Information
The last is wrong, it should be just "Fatal". If you log with type="Fatal information", the log has a severity of "Information".

Dreamweaver MX 7.01's Code Hints has the same mistake.
oneishy_ said on Jul 7, 2004 at 1:41 PM :
the attribute file="" is marked as optional (which it is) but it is not specified that the the application.log is the default file which will be written to.
ASandstrom said on Aug 2, 2005 at 12:46 PM :
The list of fields should read:
type
thread
date
time
application
text

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p72.htm