Skip to main content
Participant
April 23, 2008
Question

Saving output to file

  • April 23, 2008
  • 4 replies
  • 458 views
I have a scheduled task that runs once every night. I have set the scheduled task to output to a file.
The output file just has the date and time of completion.
It works great! When I checked the output file, it always shows the latest completion Date and Time. Is there anyway to show a history? Instead of just capturing the latest completion date and time, is it possible to include all the resutls that got run from the beginning? I could not find a setting like that in the CF Admin.
This topic has been closed for replies.

4 replies

BKBK
Community Expert
Community Expert
April 24, 2008
Open the page that is the URL of your scheduled task in an editor. Append the following line at the end and save:

<cflog log="scheduler" text="">

Coldfusion will create the file scheduler.log in the logs directory. It will record the dates and times the task is performed.



Inspiring
April 23, 2008
or you could write to a database instead of a file.
Inspiring
April 23, 2008
Instead of having the Scheduled Task in Admin output to file, you could actually code a CFFILE tag into the end of the actual script you are callingin the first place. This way you can have it append the data to the file rather than overwrite it.

The process in the admin section merely writes the output to a file and replaces the file if it exists already.
Inspiring
April 23, 2008
joejo318 wrote:
> I have a scheduled task that runs once every night. I have set the scheduled
> task to output to a file.
> The output file just has the date and time of completion.
> It works great! When I checked the output file, it always shows the latest
> completion Date and Time. Is there anyway to show a history? Instead of just
> capturing the latest completion date and time, is it possible to include all
> the resutls that got run from the beginning? I could not find a setting like
> that in the CF Admin.
>


Not from the CF admin or with the schedule task interface. The output
file is more for debugging the schedule task itself then to be a log or
history of the task ran. But it would be fairly trivial for the
template that the task runs to do this for itself.

Generate|capture the desired output and append it to any file you desire
with the <cffile...> or <cflog...> tags.