如何从内部记录信息
我正在学习使用
。
有什么方法可以在 <cfscript>
中记录一些消息或值吗?
就像外部
我可以使用
,有什么方法或标签类似的东西,我可以用来打印日志文件中的消息> ;
谢谢
I am learning to use <cfscript>
.
Is there any way I can log some messages or values inside the <cfscript>
?
like outside <cfscript>
I can use <cflog>
, Is there any way or Tag something like that, i can use to print the messages in log file inside >
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ColdFusion 9 添加了“writeLog”功能,允许您执行此操作。 http://help.adobe.com /en_US/ColdFusion/9.0/CFMLRef/WS48D04B65-0694-44e9-9E35-F9D7C9152B6C.html
ColdFusion 9 added the "writeLog" function which allows you to do this. http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS48D04B65-0694-44e9-9E35-F9D7C9152B6C.html
在 Lucee/Railo 中,您可以通过删除尖括号和“cf”前缀在脚本中使用 cflog,因此您可以编写
这相当于
In Lucee/Railo you can use cflog in script by removing the angular brackets and the "cf" prefix, so you can write
this is equivalent to
不幸的是,在 CF9 之前的 ColdFusion 版本中没有。但是,您可以做的是将 UDF 映射到 cflog:
在 cfscript 内调用 doCFLog 函数,其属性与 cflog 相同,例如
。 doCFLog(text='sometext', type='警告',application='yes', file='mylog');
注意:将方法/udf 等调用与现有函数或标记相同的名称并不是一个好主意,因此不要调用函数“cflog”或“log”
Unfortunately on versions of ColdFusion prior to CF9 there isn't. However, what you can do is map a UDF to cflog:
inside your cfscript call the doCFLog function with the same attributes as you would cflog
eg. doCFLog(text='sometext', type='warning',application='yes', file='mylog');
Note: its not a good idea to call your methods/udf etc the same name as an existing function or tag, hence not calling the function "cflog" or "log"