6 May 2025

Smart Logging Practices for Maximo Automation Scripts

Every hour of Maximo consultancy counts. Let’s be honest — nobody wants to waste time and money on preventable issues. So let me share a powerful tip I learned while working in one of the top software engineering teams at Philips — a simple practice that can save your Maximo team hours of frustration and significantly speed up issue resolution.

Maximo’s automation scripts are powerful but can quickly become black boxes if you don’t log properly. When something breaks, you need clear, actionable information — not vague error messages or no messages at all.

!! When logging in Automation scripts always capture on crucial parts:

%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
flowchart TD
    id1(What happened) 
    --> id2(When it is happening)
    id2 
    --> id3(Why it is happening)
    --> id4(What is the result of this action or error)

To put this into practice, use a structured logging format like:

logger.error | info | debug | warn("Script [SCRIPT NAME]: [describe what happened] → [when] → [why] → [what will happen because of it]")

⚠ You don’t need to log every single action in the script. Focus only on critical parts — especially:

  • When something crucial for business logic is happening (e.g., asset statuses, financial data, approvals) to ensure traceability.
  • When integrating with external systems or APIs - log key points where the script depends on third-party services, so you can trace failures.
  • Inside try/catch blocks around risky or essential operations
  • When something can cause failure or break business logic
  • When an exception is caught, and you need context for debugging

Practical Logging Advice

1. Start with the right logging level:

  • DEBUG → Technical details for debugging (e.g., input values)
  • INFO → General updates on normal operations (e.g., script started)
  • WARN → Something unexpected, but script continues (e.g., missing config, using default)
  • ERROR → Something failed and needs attention (e.g., item not found)
  • FATAL → Critical failure; system shuts down (e.g., lost database connection)

2. Make logs searchable! Always start log entries with the script name so issues can be quickly traced back to their source.

3. Log clearly what the problem or action is, why it’s happening, and what the result or consequence is. Write logs from the user’s perspective - remember, the person reading the log later might not be the original script author! Write messages that explain the problem clearly, not just the raw technical error.

4. Add contextual information - include key input values or identifiers in the log (like work order number, asset number, or script parameters) to help trace the issue.

Example:

logger.error("Script COMPANYSCRIPT: An error occurred after saving the work order " + str(wonum) + " — a required record was not found in the system because it does not exist yet, so related fields <...> will remain empty.")

Want to level up your Maximo Automation Scripting ?

We offer workshops and consultancy to help your team write smarter and bulletproof scripts.

📩 Book your session today and learn from the best: info@maximovalue.nl

Anna van den Akker

Experienced IBM Maximo consultant with a solid software engineering background. I help businesses improve their systems effectively, handling tough tasks and delivering great outcomes.
Category

Share this post on: