Setting up log4j logging on BPM8.x


UPDATE (March 15 2018): See an updated version of this article that talks about "Setting up log4j2 (version 2) in IBM BPM 85x/86"

BPM has gone to using the native WAS logging, however log4j is still packaged and shipped with BPM, so if you want to try using it, you can.

  • Create a log4j.xml. The one I used is attached.
  • I put this file on my windows server under C:\IBM\BPM\customLogger.
  • Next, in the Process Designer, I created an Integration Service that was just a start->Server Script->end. In the script, I put in the following code:"C:/IBM/BPM/customLogger/log4j.xml");
var myLog ='CWSCommitBatch');
myLog.debug("This should be working at this point");

  • The first line will re-parse the log4j.xml file and then the next lines will log to the file. This verifies it works.
  • Next, we test the rolling appender by modifying the script:"C:/IBM/BPM/customLogger/log4j.xml");
var myLog ='CWSCommitBatch');
for(var i=0; i<2000000; i++){

myLog.debug("This should be working at this point");

  • This worked as well creating multiple log files.
  • The last step is to set the logger in the WAS console and remove the parsing line from the script (so we don't re-parse on the next test). Thus the code is now:

var myLog ='CWSCommitBatch');
for(var i=0; i<2000000; i++){

myLog.debug("This should be working at this point");

  • As for setting the WAS console settings:
    • Login to the WAS Admin Console and navigate to: Servers -> Server Type -> Websphere Application Server -> <SERVER> -> Java and Process Management -> Process definition -> Java Virtual Machine
    • In "Generic JVM Arguments", add " -Dlog4j.configuration=file:C:/IBM/BPM/customLogger/log4j.xml"
    • Stop the server
    • Delete all the old logs - this to ensure the logging once the WAS server arguement is set is working.
    • Start the server
  • Once the server is back up, I logged into the Process Designer and re-ran the service to see if the logs were created and rolling.

NOTE: At this time, the rolling file appender does not work if you set the parameters using the WAS console only (as described above).  To make that work, you must call the DOMConfigurator line to enable this.  If you want this to work permanently in BPM 8.5, you can:

  • Engage BP-3 Labs to assist you.
  • Create your own solution by either calling the DOMConfigurator every time you log something or using a toolkit to log items.
Have more questions? Submit a request


Powered by Zendesk