Agent Logging

Just looking for advice on agent logging. Usually, when I create an agent I build in some logging where errors and information are written to a document in the same database where the agent resides. Then I have an agent log view to display those documents. I’ve never used the agentLog class but it looks interesting. Would there be advantages to using this to write to a separate agent log database? Obviously I wouldn’t need the design elements I currently put into each of my apps to hold the agent log ‘stuff’. And I could have all my database’s agents write to one place. But what about performance? Will there be a negative impact to writing to a different database than the current one? What other advantages and disadvantages are there? I haven’t been able to find much info on it other than the basics in the help file.

Any advice is appreciated.

Subject: Agent Logging

I wrote a script library and put in it a class called something like Logger. The object can be instantiated by an agent or in the Notes client or anywhere script can run. You call .WriteText() whenever you want something recorded. If this method has been called when the object passes out of scope, the object mails a document to a mail-in database.

This only works if the current id has the rights to create a document in the current database. You have to check for exceptions arising from that and basically ignore them; I have left out all that stuff below. In such a case the object does nothing.

I use this for an app where I have the Notes client writing data to SQL Server. If this fails the failure is logged using this class, the Notes document is put in a folder, and a scheduled agent polls the folder and tries the same update that evening. This agent uses the same class to record any errors that occur.

Note that the code using the class does not have to do anything to make sure the error data gets recorded, saved, mailed etc, nor does it have to know where this data is going. The class takes care of all that once you call .WriteText().

You could also pass in the name of the mail-in database you want any document mailed to, that might simplify reusing the class across many apps, unless you want all logs mailed to the same place.

class logger

private notesdocument d

private item as notesitem

private dirty as boolean

sub new

d= new notesdocument

item = new notesitem(d, “Body”)

item.text = "Log started for "+s.username+ " at "+cstr(Now)

dirty = false

end sub

public sub WriteText( eventtext )

item.appendtotextlist(cstr(Now)+ eventtext)

dirty = true

end sub

sub delete

if dirty then

item.appendtotextlist("Log finished at "+cstr(Now))

' mail d to a mail-in database

end if

end sub

end class

Subject: Agent Logging

There can be advantages to logging all agents into a central db. There is a problemif you go across servers since background agents can’t connect to another server unless

you configure the servers to be trusted (only available in R6).

I also trace agents running in a database by logging their run in a document.

I have found these traces great for determining production problems. However, I

also got tired of watching all the traces each day. So I created a central

event monitoring application. This application is a central catcher for

“events of significance” for all agents (regardless of where they run).

See the snip below from a previous post on this which was in reference to

determining server availability.

Just some food for thought.

HTH,

<<>>>>>>>>>>>>

I would suggest setting up your own Application Event Monitor (AEM) (see my article

reference below which has a free download database with sample code).

You would write an agent that tests the server(s) availability.

This agent would send an “Event Message” to the monitor confirming that everything is fine.

You’ll then configure an “Event Handler” that looks for a specific confirmation message

on a specific schedule (e.g. “Servers are alive and well” every 1 hour).

If this message is not received your “Event Handler” will send email to those concerned.

Event Handlers are setup for each application that you want to monitor and are highly

configurable. You specify the action to take when events are found and when they are NOT found.

Applications that do not report a status was my biggest interest in developing this tool.

I am working on a event action for a pager but it’s not available yet. Suggestions on how to

call a pager from LotusScript are welcome.

There is also a self monitoring feature with the tool so that I get notified each day

that the monitor itself is running ok. This tool has saved me countless

hours baby sitting applications. I only have to look for the monitor confirmation email

each morning and I don’t have to worry about all the other applications that I’ve

instrumented for monitoring.

Any application that can send e-mail or make a URL connection can be monitored.

I currently monitor stand-alone Java applications and DB2 scripts in addition to a

dozen or so Notes applications. I’ve also instrumented all my “On Error”

catchers so that they send messages to the monitor.

“AEM — A Tool for Automatically Monitoring Your Applications”

from THE VIEW, May/June 2004

http://www.eview.com/eview/viewr5.nsf/0/d5e78ab6f111a37f85256e9f004440d7?OpenDocument

HTH,

<<>>>>>>>>>>>>

Subject: Agent Logging

Hi,

it depends pretty much on how your support processes are set up, and what tools you are using to monitor your environment. If you are logging directly into the database, where the action or error occurred, you need someone to look into the logs frequently. This does not scale very well. If you have 100 databases, it is not feasible to have somebody look into 100 databases every day. It might work, if you have a tool, that aggregates the information from the 100 databases and sends a report.

If you are using a central repository where all log information is collected and categorized in a useful manner, it is no problem for one person to monitor 100 databases, possibly many many more. The Notes Agent Log template is a good starting point. It is very simple, yet useful.

I have created a LotusScript Library that lets you use the Agent Log in a very simple and intuitive way. It is Free Software licensed under the LGPL, so you can use it in your own application. The software is called smart, and you can download it by following the link.

Best regards
Mario Varchmin