Link to home
Start Free TrialLog in
Avatar of KenyonKen
KenyonKen

asked on

Open Agent Log using LotusScript

I have run a specific agent in the following code:

Set theAgent = db.GetAgent(Cstr(agent.Name))
Call theAgent.Run

At the same time, I want to open the Agent Log after the Agent run. But, it cannot open the Agent Log and error message cannot occur. How can I do that?

Avatar of scottrma
scottrma

In your agent, you need to create a NotesLog class object and then log to it as follows:

Syntax
Dim variableName As New NotesLog(programName$)
or
Set notesLog = New NotesLog(programName$)

Parameter
programName$
String. A name that identifies the log.

Usage
Once you create a log using New, use the OpenAgentLog method to open the log before writing to it. You must explicitly log each action and error using the following methods:
To log an action, use LogAction.
To log an error, use LogError.
Notes does not automatically log actions or errors for you.

Regards,

Scott
Avatar of KenyonKen

ASKER

Thanks....Scott

I can implement the Agent Log now, but I need to do more is that I want to open the Agent Log just like when I test the Agent in Notes Designer. The report pop up after the agent run. Can I do this?

Cheers,
Kenyon
I don't think you can do this. I checked all the methods and properties in the NotesLog and NotesAgent class, and I don't see where you can do this. The little dialog window you are talking about only seems to come up when the agent is invoked from Domino Designer. You can use the following code to write to the agent log:

     Dim agentLog As New NotesLog("Agent log")
     Call agentLog.OpenAgentLog
     Call agentLog.LogAction("Action one")
     Call agentLog.Close

but there is no code available to make the little window pop up if the agent was not called to run from within Domino Designer, nor is there any code to programmatically read from the agent log, only to write to it.

Sorry, I have checked everywhere, so unless I am missing something (other experts will tell you immediately if this is the case), I don't think you can do what you are asking.

Regards,

Scott
Hi Scott,

I also find all the meothods to provide that agent log, but still not find. So, I can only use :

"Call currentLog.OpenFileLog( "c:\log.txt" )"

to output the agent log instead. Do you have any more suggestions?

Cheers,
From Kenyon
ASKER CERTIFIED SOLUTION
Avatar of scottrma
scottrma

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks o lot, Scoot.