如何从内部记录信息

发布于 2024-08-21 02:36:17 字数 236 浏览 2 评论 0原文

我正在学习使用

有什么方法可以在 <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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

兲鉂ぱ嘚淚 2024-08-28 02:36:18

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

自演自醉 2024-08-28 02:36:18

在 Lucee/Railo 中,您可以通过删除尖括号和“cf”前缀在脚本中使用 cflog,因此您可以编写

<cfscript>
  log text="some text" file="logfilename" type="information";
</cfscript>

这相当于

<cflog text="some text" file="logfilename" type="information">

In Lucee/Railo you can use cflog in script by removing the angular brackets and the "cf" prefix, so you can write

<cfscript>
  log text="some text" file="logfilename" type="information";
</cfscript>

this is equivalent to

<cflog text="some text" file="logfilename" type="information">
傲娇萝莉攻 2024-08-28 02:36:18

不幸的是,在 CF9 之前的 ColdFusion 版本中没有。但是,您可以做的是将 UDF 映射到 cflog:

<cffunction name="doCFLog">
   <cflog attributeCollection="#arguments#">
</cffunction>

在 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:

<cffunction name="doCFLog">
   <cflog attributeCollection="#arguments#">
</cffunction>

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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文