Skip to main content
Nov 7, 2023 12:58 PM UTC
Solved

Log4j 2.0 updated APIs

Hello,

 

I am currently migrating the codebase from Windchill 11.1 to 12.0 and facing issues in the new log4j 2.0 package, namely in the following APIs-

Layout layout = new PatternLayout("%d [%t] %-5p %c - %m%n");
FileAppender appender = new FileAppender(layout, WTProperties
.getServerProperties().getProperty("wt.logs.dir")
+ File.separator + "SetStateOfAffectedObjects.log");

logger.addAppender(appender);

 

Anybody has any suggestions for the same?

 

Thank you,

Ramsha 

 

 

Nov 9, 2023 12:22 PM UTC

Hi @RK_10805837 

So what is your problem?

If you import correct packages, there can not be any issue.

 

do not forget to import all sub packages correctly... 

PetrH

5 replies

Nov 7, 2023 1:00 PM UTC
Nov 8, 2023 9:56 AM UTC

Hi @RK_10805837 

If you migrating your code you need to update all apache logger import usage.

The logger is upgraded to new version so you need to change the apache package in any class import.

 

from

org.apache.log4j.Logger

to

org.apache.logging.log4j.Logger

 

the change apply for all apache log4j classes so

org.apache.logging.log4j.*

 

there is also variable change in the wt.properties file(but this is OOTB changed)

-Dlog4j2.configurationFile\=$(wt.manager.log4j.config)

 

PetrH

Nov 9, 2023 10:28 AM UTC

Hi @HelesicPetr ,

yes I have included those packages. I

Nov 9, 2023 12:06 PM UTC

I think your message was cut off.