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?

KenyonKenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

scottrmaCommented:
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
0
KenyonKenAuthor Commented:
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
0
scottrmaCommented:
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
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

KenyonKenAuthor Commented:
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
0
scottrmaCommented:
Well, yes, if you use OpenFileLog, then you will have the logging contents as a file on disk, and you could subsequently access that file, either manually or programmatically.

The only other way would be to code the logging mechanism yourself. That would basically involve creating a database with a form and fields and views to hold your log data and then in your agent you simply create log documents in this database. The Agent Log you are referring to doesn't really give out that much information anyway, just things like agent start time, number of documents the agent found to run on, agent end time. So it would be fairly easy to code this yourself. Example: use the Now() function at the beginning and end of your script to get the agent start and end times, and use session.CurrentDatabase.UnprocessedDocuments.Count property to get the number of documents the agent found to run on. Then just write this info to your custom log database.

Regards,

Scott
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KenyonKenAuthor Commented:
Thanks o lot, Scoot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.