创建包含文件日志的ColdFusion [英] create contain file log coldfusion

查看:179
本文介绍了创建包含文件日志的ColdFusion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个日志文件。我试过,但它给我一个错误。任何人可以帮助?我在此显示我的完整代码:

I want create a log file. I tried but its show me an error. Can anyone help? I show my full code here:

http://pastebin.com / SxAMCUnv

请参阅这一行。我不知道发生了什么,可以输出错误:

Please see this line. I don't know what happened with it, can output error:

<cffile action="WRITE" file="#expandpath('API.log')#" 
    output="#filecontent#" addnewline="Yes" fixnewline="No"






修改:我尝试过,显示错误:


I tried and it showed me an error:


在第213行第110列中找到无效的CFML结构。ColdFusion
正在查看以下文本:

Invalid CFML construct found on line 213 at column 110. ColdFusion was looking at the following text:

'

CFML编译器正在处理:

The CFML compiler was processing:

A cffile tag beginning on line 213, column 2.


行:

<cffile action="WRITE" file="#expandpath('Info.log')#" 
   output="#filecontent#" addnewline="Yes" fixnewline="No" 

我发生了什么事?

推荐答案

一些事情。


  1. 当你得到一个错误:告诉我们是什么错误,不要简单地说你有一个。

  2. 当你发布代码,只有post代码与您的情况相关,不要张贴全部代码。你已经给了我们差不多200行代码,几乎所有的代码都不相关。

  3. 你没有指出你自己在这里做了什么。

  1. When you are getting an error: tell us what the error is, don't simply say you got one.
  2. When you're posting code, only post code that's relevant to your situation, don't post all the code. You've given us almost 200 lines of code to wade through, almost all of it not being relevant.
  3. You've given no indication of what troubleshooting of your own you've done here. It's basically like you're asking us to simply do your work for you.

如果你澄清你的问题,我会把我的

If you clarify your question, I'll take my down vote off.

一看到你的代码表明你试图写出一个变量 fileContent 但是在任何时候你都没有设置该变量。没有看到错误,没有办法知道是否是问题,或者变量是在你未包含的代码中创建的。

A superficial glance at your code suggests you're trying to write out a variable fileContent, but at no point do you actually set that variable. Without seeing the error, there;s no way of knowing if that's the problem, or the variable is being created in code that you haven't included.

另一个考虑因素是你在这里重新发明轮子。 ColdFusion有一个内置的 < cflog> 标记或 writeLog() 语句写入日志文件。

Another consideration is that you're re-inventing the wheel slightly here. ColdFusion has an inbuilt <cflog> tag or writeLog() statement for writing to log files.

=====

UPDATE(基于对问题的更新)
这是一个编译错误,错误的行不是您在代码(@ pastebin),这有点奇怪。你能确认第213行是< cffile> 行吗?你可以重现整个行(你引用的代码段是不完整的)。但基本上错误消息告诉你出了什么问题:你的代码中有一个语法错误。它可能在特定的语句中的错误消息说(行和列),虽然有时取决于代码,CF编译器可能会感到困惑,并且前一行中的语法错误可能会报告为进一步向下的文件比它实际是。但对于初学者,发布整行代码,而不仅仅是它的第一位。

UPDATE (based on updates to the question) That's a compile error you're getting, and the line that's erroring is not the line you indicated in your code (@ pastebin), which is a bit odd. Can you confirm line 213 is that <cffile> line? And can you reproduce that line in its entirety (the snippet you quoted was incomplete). But basically the error message is telling you what's wrong: you have a syntax error in your code. It could be in the specific statement the error message says (line and column), although sometimes depending on the code, the CF compiler can get confused and a syntax error in a preceding line might be reported as being further down the file than it actually is. But for starters, post the whole line of code, not just the first bit of it.

这篇关于创建包含文件日志的ColdFusion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆