Domino Code Fragment
Code Name* LogError method | Date* 04/28/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.18.224.44.108 | |
Description* This agent searches for "Rocks" in the documents in the current database and logs an error message to logerror.log in the current Notes directory if no occurrences are found. | Type* Java | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class logerroragent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
AgentContext ac = s.getAgentContext();
Database db = ac.getCurrentDatabase();
Log log = s.createLog("Geology Agent");
log.openFileLog("logerror.log");
DocumentCollection dc = db.FTSearch("Rocks", 0);
if (dc.getCount() == 0)
{
log.logError(0, "No documents found");
}
else
{
Newsletter news = s.createNewsletter(dc);
news.setSubjectItemName("Subject");
Document doc = news.formatMsgWithDoclinks(db);
doc.appendItemValue("Form", "Memo");
doc.appendItemValue("Subject", "The Rock Report");
doc.send (false, s.getUserName());
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}