Thank you.
Original Message:
Sent: 12-28-2023 04:52
From: mark robbins
Subject: Log4j not work when upgrade Max761 to max8
Hi Eric,
Is there a specific reason why you are not letting Maximo manage the loggers for you?
Presumably you are making a connecvtion to the MXServer object for your work, or the code is running within Maximo.
If either of those statements is true then your code can just ask the MXServer object for a specific logger and the MXServer object manages everything for you e.g. the log level, managing the log4j code.
------------------------------
mark robbins
Cohesive
IBM Champion 2017-2023 Inclusive
See my blog on Maximo support related topics here:
https://www.linkedin.com/pulse/maximo-support-advice-from-non-ibm-engineer-article-mark-robbins/
------------------------------
Original Message:
Sent: 12-20-2023 13:00
From: Eric Zuo
Subject: Log4j not work when upgrade Max761 to max8
Hi Jason,
for the error in line 68 in the screen shot above, if I follow the suggested
, changed the getLogger(String str) to getLogBuilder(Level level) , but the Level is set in Maximo logging app, I should get it from Maximo, then how to get the level from maxim. even I use a constant to test it, still not work:

Therefore I doubt the suggested "Quick fix" is incorrect.
Please forward instruction .
Thanks,
Eric
------------------------------
Eric Zuo
San Francisco Bay Area Rapid transit
Original Message:
Sent: 12-19-2023 16:23
From: Jason VenHuizen
Subject: Log4j not work when upgrade Max761 to max8
Original Message:
Sent: 12/19/2023 4:13:00 PM
From: Eric Zuo
Subject: RE: Log4j not work when upgrade Max761 to max8
HI Jason,
I updated the code as you pointed, fixed a lot of error related to SmtpAppender and FileAppender . Thank you very much.
Then another error occurred. the line 68 which is the line 61 in the screen shot above.

If change the line 68 as suggested, getLogBuilder requires Level as parameter. But how to get the Level (debug, error,..)
could you please help again?
The import for log4j2 is:
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.appender.SmtpAppender;
import org.apache.logging.log4j.core.appender.FileAppender;
Thanks,
Eric
------------------------------
Eric Zuo
San Francisco Bay Area Rapid transit
Original Message:
Sent: 12-19-2023 12:07
From: Jason VenHuizen
Subject: Log4j not work when upgrade Max761 to max8
Eric,
You probably want to use the FileAppender.newBuidler() method to get a FileAppender.Builder that can be used to build your file appender with desired attributes, something like the following:
FileAppender.Builder b = FileAppender.newBuilder();b.withFileName("myfile");b.withAppend(true);b.setName("my-appender");b.build();FileAppender fa = b.build();
Jason
------------------------------
Jason VenHuizen
Sharptree