例: NumErrors property (Log - Java™)

次のエージェントは、ログメッセージ内のエラーの数を出力します。

import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Log log = session.createLog("Counting errors");
      Vector v = new Vector();
      v.addElement(session.getUserName());
      log.openMailLog(v, "Here's your log");
      log.logError(0, "Error number " + (
      log.getNumErrors()+1));
      log.logError(0, "Error number " + (
      log.getNumErrors()+1));
      log.logError(0, "Error number " + (
      log.getNumErrors()+1));
      log.close();
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}