Logging Events
Logging Events
- Subject: Logging Events
- From: Ted Wood <email@hidden>
- Date: Wed, 13 Dec 2000 16:23:18 -0800
At 12:04 PM -0800 13/12/00, "Randy Fingeroot" <email@hidden> wrote:
I'm working on a script to help troubleshoot a problem we've occasionally
had. I'd like to have a log for each time a user uses the script with the
results of the application. Anybody got any tips?
Hi Randy,
Let me see if I follow you. The problem you've been experiencing is
with the script in question? Or another application?
Basically, you can have the script save the results to a text file,
along with the current time and date that execution took place.
I suggest using the Read/Write osax for this purpose. You just need
to specific the target log file and the rest is easy. Take a look:
-- add this code to your script: --
set logFile to (open for access path_name_of_log_file with write permission)
set fileLength to (get eof logFile)
write (return & ((current date) as string) & " - " & resultFromApp as string) ,
to logFile starting at fileLength + 1
close access logFile
where path_name_of_log_file is a complete path to the log file for
saving results;
and resultFromApp is the result you want to save to the log file.
Give it a try and let me know how it goes. =)
Ted