< Back

Document Subject: Agent Log Code
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#agentLog or http://A555F9/nn.nsf/ByAlias/agentLog

Agent Log Code, this allows the agent to log details into the




 

You can do code templates in Lotus Notes 8.5

This is a code template or code snippet for an agent in lotusscript which includes error handling and logging.

 

'This agent runs daily or hourly and will blah
'01-Jan-2011 Adam Foster  First Version Adam Foster
'02-Jan-2011 Adam Foster  Production Version  

 On Error goto eh
 
 Dim s As New notessession
 Dim db As notesdatabase
 Set db=s.currentdatabase
 
 Dim aLog As New NotesLog("Agent Log")
 Call aLog.OpenAgentLog
 Call aLog.LogAction("Starting " & Now)
 

 'Enter your code here

 Call aLog.LogAction("Finishing " & Now)
 Call aLog.Close
 
 End

eh:
 Call aLog.LogAction("Error " & Error$ & "(" & Err & ") at line " & Erl )
 Call aLog.Close