Domino Code Fragment

Code Name*
lotus.notes.Log class
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.219.189.247
Description*
3. This example opens a Notes log and logs an error. The database agentlog.nsf must be based on the StdR4AgentLog template.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;
import java.util.Vector;


public class log3agent extends AgentBase
{
 public void NotesMain()
 {
   try
   {
     String viewName = "Bad view";
     Session s = getSession();
     AgentContext ac = s.getAgentContext();
     Agent agent = ac.getCurrentAgent();
     Database db = ac.getCurrentDatabase();
     Log log = s.createLog(
     agent.getName() + " Agent in " +
     db.getTitle() + " on " + db.getServer());
     log.openNotesLog(null, "agentlog.nsf");
     View view = db.getView(viewName);
     if (view == null)
     {
       log.logError(0, "Unable to find view " +
       viewName);
     }
     log.close();    
   }
   catch (Exception e)
   {
     e.printStackTrace();
   }
 }
}