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
Original Message:
Sent: 12-18-2023 18:27
From: Eric Zuo
Subject: Log4j not work when upgrade Max761 to max8
Hello All,
We have customized java programs worked well in Max7.6.1, now we are upgrade Maximo to MAX8, I am trying to port the eclipse java project for Max8. We use the new jar from MAX8 lib folder. Fro example, log4j.jar is removed, replaced by log4j-api-2.17.1.jar and log4j-core-2.17.1.jar.
import org.apache.log4j.FileAppender;
import org.apache.log4j.net.SMTPAppender;
is replaced by
import org.apache.logging.log4j.core.appender.SmtpAppender;
import org.apache.logging.log4j.core.appender.FileAppender;
But we got a lot of errors, the log4j is a significant and complicated one.:
The FileAppender constructor in log4j.jar takes 2 parameters , and in Max8 lib, it takes much more parameters.
I may need to rewrite our functions . Anybody has successful approach or good document for this kind issue?
What value should be set for the following attributes required by org.apache.logging.log4j.core.appender.FileAppender.class :
private boolean locking;
private boolean advertise;
private String advertiseUri;
private boolean createOnDemand;
private String filePermissions;
private String fileOwner;
private String fileGroup
In addition, I would like to know should we only use the lib from MAX8 lib? for example, for log4j, can we still use the log4j.jar in MAX8?
please help.
Thanks,
Eric
#Architecture
#Customizations
#EverythingMaximo
#MaximoUserGroups
#Utilities
------------------------------
Eric Zuo
San Francisco Bay Area Rapid transit
------------------------------