Hi there,
I am working with Camunda for few months now and I want to utilize the logs a little bit more.
What do I want to achieve?
Logging Camunda Engine calls and behavior from categories like “org.camunda.bpm.engine.jobexecutor” as written in the docs, to a file.
What did I do?
I consulted the docs (Logging | docs.camunda.org) how to configure logging. I think logback is the way I could use best, so I tried to do like it is documented.
→ There seems to be a missing link in the docs to “SLF4J Documentation”.
However, it’s not working as expected. There was no different logging output at all.
Through search in the forum, I found the thread where thorben was giving a good answer and OP said “It worked”.
At least the Engine outputs all the categories in the JUL log (Java Window). Nevertheless, I want that to be written in a file. But the logback.xml seems to be ignored.
My Steps
Download fresh Camunda Community Tomcat distribution
Copy logback-classic & logback-core to global lib in server/apache-tomcat/lib
Create a logback.xml inspired by Camunda docs (Copy-Paste) and add a file appenter
The easiest way on Tomcat is to configure Tomcat’s JULI logging which the engine integrates with by default. So you would use the Tomcat distribution as is and add your logging configuration to ${TOMCAT_HOME}/conf/logging.properties For example:
I tried it and it’s basically what I want to achieve (without logback but doesn’t matters) .
I extended the entry with a seperate FileHandler, that’s easier to parse later on.
5jobexecutor.org.apache.juli.AsyncFileHandler.level = FINE
5jobexecutor.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
5jobexecutor.org.apache.juli.AsyncFileHandler.prefix = jobexecutor.
5jobexecutor.org.apache.juli.AsyncFileHandler.maxDays = 90
org.camunda.bpm.engine.jobexecutor.level = FINE
org.camunda.bpm.engine.jobexecutor.handlers = 5jobexecutor.org.apache.juli.AsyncFileHandler
We recently enabled logging using Tomcat JULI as mentioned by Thorben below. In order to create a separate log file for each of business processes (distributed as war-files) we added a logging.properties file in /resources folder of each of the processes (please don’t forget to remove .txt ext):
The only missing part of the equation is ability to define custom logging format like below as JULI does not take those definitions into account: java.util.logging.SimpleFormatter.format=[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL] %4$s: %5$s %6$s %n
The following groovy script dumps variable contents at each process step (if added into execution listener of the task) via Tomcat JULI:
Thank you for your email. Formatting works well if you define it Tomcat-wide, however, is not taken into account on per process basis. We are a bit limited in a way we can change configuration of the distribution,so this is still something to explore.