Reputation: 89
Hi I am writing an automation script in Maximo that fires on a cron task. I am having trouble inserting a line break in my print statement. I have tried '\n' & just adding a print() in between my prints. Neither are working and all my prints are being packed into one line in my log file.
Upvotes: 2
Views: 1275
Reputation: 900
You could instead use the provided log() method on the service implicit variable to achieve the same result. Every call will generate a line in your log file. https://www.ibm.com/support/knowledgecenter/SSLLAM_7.6.0/com.ibm.mbs.doc/autoscript/r_variables_automation_scripts.html
Also, if you want more control on the log levels, you can get a logger directly from the Logger API which is basically a Log4J wrapper:
from psdi.util.logging import MXLoggerFactory
logger = MXLoggerFactory.getLogger("maximo.integration")
logger.info("Integration logger used from automation script")
You would then control its log level from the Logging application.
Upvotes: 5
Reputation: 89
Using the log() method will achieve the correct result. If you also do want to still use print I have found out \n will only work if it is preceded by \r in a Maximo automation script like '\r\n'
Upvotes: 0