Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Enterprise Tools / August 2004

Tip: Looking for answers? Try searching our database.

EIF Logging to a new trace file everyday

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
raja - 05 Aug 2004 15:06 GMT
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 hel

Thank

---
Mike Hayton [MS] - 19 Aug 2004 17:43 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

| ---

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.