script log file (how)
- From: "Steven" <sdixon@xxxxxxxxxxxxxx>
- Date: Thu, 25 Jan 2007 20:06:25 -0800
I have a DOS batch file I use for backing up certain files and then burning
them to DVD's using nero once a week.
The problem with my original script was that it didn't keep any logs of what
it did and/or when it fails. If anything fails I had to investigate it
manually (time consuming).
I've since modified it to redirect any "console" output to a text file and
inserted "you are here" type ECHO's throught the script. The output also
creates a new log file every year so a single log file doesn't get too big
if no one ever purges it. Now I have a record of the previous 1 to 52 runs
but the logs eventually take up space and become difficult to work with.
I want to modify the script to maintain a single log file and purge old
records as needed. I want it to be self contained and not grow out of
control.
Q1: Is there an easy way to keep an ongoing record of previous runs in a log
file AND also prevent the log file from ballooning into a huge file (I want
it be a maximum size of 1 MB, or only keep a certain number of runs if
possible)?
Here is a snippet of the script I run (working portions removed for
brevity):
[start]
echo start
echo copy files into archive
echo burn archive using nerocmd.exe
echo done
[end]
command= c:\scripts\burnit.bat >> burnit_log_%date:~10,4%.txt
Result:
-creates a "burnit_log_2007.txt" file and appends all output that would
normally be printed to the screen during each run
-burnit_log_2007.txt can grow to a large size if problems are encountered or
the file is never purged
.
- Follow-Ups:
- Re: script log file (how)
- From: Jeffery Hicks
- Re: script log file (how)
- Prev by Date: Debugging VBScript
- Next by Date: Re: User account attributes
- Previous by thread: Debugging VBScript
- Next by thread: Re: script log file (how)
- Index(es):
Relevant Pages
|