RE: EIF Logging to a new trace file everyday
From: Mike Hayton [MS] (mikehayt__at_online.microsoft.com)
Date: 08/19/04
- Next message: Mike Hayton [MS]: "RE: EIF corrupting event log files on unexpected machine failure?"
- Previous message: Mike Hayton [MS]: "RE: Question about whitehorse"
- In reply to: raja: "EIF Logging to a new trace file everyday"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Aug 2004 16:43:56 GMT
You might want to run the following script to roll over the log files.
Using the windows AT command you could schedule the script to run every day
Cheers
Mike
================================
wscript.echo "Script started ..."
dtNow = Now
sNow = Year(dtNow) & Right("0" & Month(dtNow),2) & Right("0" &
Day(dtNow),2) & "T" & Right("0" & Hour(dtNow),2) & Right("0" &
Minute(dtNow),2) & Right("0" & Second(dtNow),2)
Set traceSettings =
CreateObject("Microsoft.EnterpriseInstrumentation.Configuration.TraceSetting
s")
strTraceConfigFile = traceSettings.GetConfigFileLocation()
traceSettings.load(strTraceConfigFile)
Set colTraceSessions = traceSettings.TraceSessions
For Each traceSession In colTraceSessions
wscript.echo "Trace Session Name: " & traceSession.Name
wscript.echo "Trace Session Log Name: " & traceSession.FileName
wscript.echo "Trace Session Status: " & traceSession.Enabled
If traceSession.Enabled Then
path = Left( traceSession.FileName, InStrRev( traceSession.FileName, "\"
) )
traceSession.FileName = path & traceSession.Name & "_" & sNow & ".log"
wscript.echo "New Trace Session Log Name: " & traceSession.FileName
End If
Next
'Since the trace session.config file has been changed we need to save it
If traceSettings.IsDirty Then
wscript.echo "Saving configuration changes"
traceSettings.Save
End If
wscript.echo "Script terminated."
--------------------
|
| All:
My application logs messages to windows trace file. It is writing to the
file TraceLog.Log and the trace session settings are default.
Everything is working fine but I would like to write to a new file everyday
instead of writing to the same TraceLog.Log.
Currently it is taking the backup of the file TraceLog.Log but I have no
idea when and how it is taking the backup.
Any one please help
Thanks
|
| ---
| Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
|
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
- Next message: Mike Hayton [MS]: "RE: EIF corrupting event log files on unexpected machine failure?"
- Previous message: Mike Hayton [MS]: "RE: Question about whitehorse"
- In reply to: raja: "EIF Logging to a new trace file everyday"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|