The OperationsLog component provides a centralized way to log operational messages within a Strolch application. These messages are typically more high-level than technical logs and are intended for operators or administrators.
Locator.INFO, WARN, ERROR, and FATAL.Information, Active, Done).To add a message to the operations log:
OperationsLog operationsLog = agent.getComponent(OperationsLog.class);
LogMessage message = new LogMessage(
realm,
username,
locator, // Optional element locator
LogSeverity.Error,
LogMessageState.Active,
ResourceBundle.getBundle("my-bundle"),
"error.key"
).withException(e);
operationsLog.addMessage(message);
The OperationsLog component can be configured in StrolchConfiguration.xml.
<Component>
<name>OperationsLog</name>
<api>li.strolch.handler.operationslog.OperationsLog</api>
<impl>li.strolch.handler.operationslog.OperationsLog</impl>
<Properties>
<maxMessages>1000</maxMessages>
<sendMails>true</sendMails>
<sendMailsMinSeverity>Error</sendMailsMinSeverity>
<sendMailsRecipients>admin@example.com</sendMailsRecipients>
</Properties>
</Component>