Logging options in a process application, from built-in to custom:
- log.info / log.debug / log.error in server-side scripts - goes to SystemOut.log of the member (BAW: also the WLE trace loggers); free, always there, but mixed with the server log. Prefix messages with app acronym and instance id.
- Activity / step logging in the engine: Process Admin > instance details, the execution tree and the Process Inspector record every step with timestamps - the audit trail of the flow itself; no code needed.
- Instance comments (the comments API of the instance, REST or JavaScript) - human-readable notes attached to the instance, visible in the portal; good for business-relevant events ("credit check overridden by X").
- Tracking groups - structured business events into the Performance Data Warehouse (and BAI on CP4BA); the right place for "what happened when" analytics, not for debugging.
- Custom log table - a toolkit service that inserts (timestamp, app, instance, step, level, message, user) into your own table; queryable, retention under your control; the most common enterprise choice.
- Java logging framework (log4j / java.util.logging in a managed jar) - files per app with rotation (question 1022); on CP4BA write to stdout instead and let the platform collect.
- Central log shipping - SystemOut / stdout to ELK / Splunk / OpenShift logging; combine with a JSON log line format from your log service so that dashboards can filter by instance id.
- Browser side - console.log in coach views for development; an "audit" Service Call for user actions worth keeping.
// toolkit service flow "Log" (level, message) - script writing a structured line to SystemOut / stdout
var line = JSON.stringify({ ts: new Date().toISOString(), app: tw.system.model.processApp.acronym, piid: tw.system.currentProcessInstanceID, user: tw.system.user.name, level: tw.local.level, msg: tw.local.message });
if (tw.local.level == "ERROR") log.error(line); else log.info(line);Guideline: the engine's own history + tracking groups cover most needs; add one custom log service for technical diagnostics with a level switch in an EPV; never log personal data or secrets; keep logs out of the BPMDB (no custom tables in it).
References