<< Google Analytics | Home | Show 'n Tell Thursday: Finding the "My Documents"-folder (17 August 2006) >>

AutoPurge for OpenLog

We are using the OpenLog logging framework written by Julian extensively in our applications but in logging intensive applications or when running with our custom DEBUG-level enabled you can generate a lot of logging documents. Cleaning these up should preferably be done automatically on a scheduled basis so I wrote a small agent to purge log documents older than 6 months and thought I would share:

Sub Initialize
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim dc As NotesDocumentCollection
   Dim dt As NotesDateTime
	
   Set dt = New NotesDateTime(session.International.Today)
   Call dt.AdjustMonth(-6)
   Set db = session.CurrentDatabase
   Set dc = db.Search(|Form="LogEvent" & LogEventTime<@TextToTime("| + dt.DateOnly + |")|, Nothing, 0)
   
   Call dc.RemoveAll(True)
End Sub
Really simple and nothing much to it...



Avatar: Martin

Re: AutoPurge for OpenLog

And why you don't use just the property in Replication setting dialog? It's maybe better, or not?

Re: AutoPurge for OpenLog

Well for one I didn't even think of it and I didn't know it would work without replication enabled. Thanks though.

Add a comment Send a TrackBack