Examples: openFileLog method

  1. This agent opens a file called append.TXT in the Domino® directory. Each action and error gets appended to the file on a separate line without writing over the existing contents of the file.
    import lotus.domino.*;
    public class JavaAgent extends AgentBase {
      public void NotesMain() {
        try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
          // (Your code goes here) 
          Log log = session.createLog("Append to file");
          log.openFileLog("append.log");
          log.logAction("Logged an action");
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent opens a file called over.TXT in the Domino® directory. Each action and error gets appended to the file on a separate line after first writing over the existing contents of the file.
    import lotus.domino.*;
    public class JavaAgent extends AgentBase {
      public void NotesMain() {
        try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
          // (Your code goes here) 
          Log log = session.createLog("Overwrite file");
          log.setOverwriteFile(true);
          log.openFileLog("over.log");
          log.logAction("Logged an action");
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }