How to configure logging in jBPM applications?

jBPM is a flexible Business Process Management (BPM) platform that is written in Java. It provides a number of features for creating and executing business processes, including the ability to log information during the execution of a process.

To log information with jBPM, you can use the log method of the org.kie.api.runtime.KieSession interface, which is the main entry point for interacting with jBPM. The log method takes a message and an optional level as arguments and writes the message to the process log.

Here is an example of how you can use the log method in a jBPM process:

import org.kie.api.runtime.KieSession;

// ...

KieSession kieSession = // obtain a KieSession instance

// log a message with the default level (INFO)
kieSession.log("This is a log message");

// log a message with the WARN level
kieSession.log("This is a warning message", Level.WARN);

By default, jBPM writes log messages to the console. You can also configure jBPM to write log messages to a file or send them to a logging backend, such as Log4j or Java Util Logging (JUL).

Besides, by default, all System.out commands will go on the default Logger.

How to configure the jBPM Logger verbosity

To configure the Logger verbosity in a JBPM application running in a Spring Boot Runtime, you can simply set the property logging.level for “org.jbpm” in the application.properties file of Spring Boot. For example:

logging.level.org.jbpm=DEBUG

On the other hand, to enable DEBUG of “org.jbpm” packages in a WildFly runtime, you can configure a Logger as follows:

<logger category="org.jbpm">
      <level name="DEBUG"/>
</logger>
Found the article helpful? if so please follow us on Socials