Java Code activity log4j logging fails after upgrading to BW 5.14.1 or BW 5.15.x

Java Code activity log4j logging fails after upgrading to BW 5.14.1 or BW 5.15.x

book

Article ID: KB0070135

calendar_today

Updated On:

Products

TIBCO ActiveMatrix BusinessWorks

Description

Log4j has been upgraded to Log4j 2 in TRA 5.11.3 and TRA 5.12.x. Because of this change, the code for logging needs to be updated in the Java Code activity.

Issue/Introduction

Java Code activity log4j logging fails with the error java.lang.NoClassDefFoundError : org/apache/log4j/Logger after upgrading to BW 5.14.1 or BW 5.15.x

Resolution

Code that works with BW 5.14.0 and earlier versions -

org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("bw.logger");
logger.warn("This is a warning message from the either a Java Code or Java Method activity");

Code that works with BW 5.14.1 and BW 5.15.x -

org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger("bw.logger");
logger.warn("This is a warning message from the either a Java Code or Java Method activity");