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

查看:29
本文介绍了创建包含文件日志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. 当您发布代码时,只发布与您的情况相关的代码,不要发布所有代码.您为我们提供了近 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.

=====

更新(基于问题的更新)这是您遇到的编译错误,并且出错的行不是您在代码中指示的行(@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天全站免登陆