我想将一些信息写入日志文件。我尝试将此代码添加到我的文件中:
<cfparam name="BillingAddressOne" default="#session.userinfo.Address1#">
<cfparam name="BillingAddressTwo" default="#session.userinfo.Address2#">
<cfparam name="BillingCity" default="#session.userinfo.city#">
<cfparam name="BillingState" default="#session.userinfo.state#">
<cfparam name="BillingZipCode" default="#session.userinfo.zip#">
<cfparam name="BillingCountry" default="US">
<cfparam name="BillingPhone" default="#session.userinfo.phone#">
<cfparam name="BillingFax" default="#session.userinfo.fax#">
<cfparam name="BillingEmail" default="#session.userinfo.email#">
<cfparam name="CardType" default="#sessioninfo.CreditCardType#">
<cfparam name="form['Credit Card Number']" default="#sessioninfo.CreditCardNumber#">
<cfparam name="expmonth" default="#sessioninfo.CreditCardExpMonth#">
<cfparam name="expyear" default="#sessioninfo.CreditCardExpYear#">
<cfparam name="CCverificationCode" default="#sessioninfo.CCverificationCode#">
<cfparam name="CreditCardName" default="#sessioninfo.CreditCardName#">
<cflog file="info.log" application="no"
text="#BillingAddressOne# #BillingAddressTwo# #BillingCity# #BillingState# #BillingZipCode# #BillingCountry# #BillingPhone# #BillingEmail# #pmtmethod# #CardType# #form['Credit Card Number']# #expmonth# #expyear# #CCverificationCode# #CreditCardName#">
我尝试输入文件info.log
答案 0 :(得分:6)
根据docs,file属性应该只包含文件名,而不是扩展名。
另外,
该文件必须位于默认日志目录中。你不能 指定目录路径。如果该文件不存在,则创建该文件 自动,扩展名为.log。
这很可能是[coldfusion install folder] / logs
尝试
<cflog file="info"
application="no"
text="#BillingAddressOne#
#BillingAddressTwo#
#BillingCity#
#BillingState#
#BillingZipCode#
#BillingCountry#
#BillingPhone#
#BillingEmail#
#pmtmethod#
#CardType#
#form['Credit Card Number']#
#expmonth#
#expyear#
#CCverificationCode#
#CreditCardName#">