janklab/SLF4M

SLF4M busted under R2022a or R2021b - log4j upgrade

HenningBraess opened this issue · 6 comments

Hi,

I installed SLF4m on Matlab R2022a (Windows 10). When I called the attached helloWorld program I got the following exception code:


Error using logger.Log4jConfigurator.configureBasicConsoleLogging
Invalid default value for property 'initializer' in class 'logger.Logger':
Java exception occurred:
java.util.NoSuchElementException

at org.apache.log4j.helpers.NullEnumeration.nextElement(NullEnumeration.java:45)

Error in logger.internal.Slf4mInitializer.initSLF4M (line 59)
logger.Log4jConfigurator.configureBasicConsoleLogging()

Error in logger.internal.Slf4mInitializer (line 12)
logger.internal.Slf4mInitializer.initSLF4M;

Error in loggerCallImpl (line 42)
loggerObj = logger.Logger.getLogger(callerId);

Error in logger.debug (line 14)
loggerCallImpl('debug', msg, varargin);

Error in helloWorld (line 6)
logger.debug('Got empty x input; defaulted to %f', x);


Is there anything that I need but did not install?

Any help is appreciated.

It appears to be an issue with R2022a. Using it with R2021a is no problem.

FYI: MATLAB releases prior to R2021b Update 2, used to include slf4j with a binding to log4j 1.2 and then also the log4j 1.2 implementation itself.

As of release R2021b Update 2, MATLAB still includes slf4j with still a binding to log4j 1.2 but now then the log4j 1.x bridge and as actual log4j implementation: log4j 2.

The issue could very well be related to this change.

Hi! Sorry I didn't notice this bug report earlier; my Watch settings for this repo must be off.

@maben-mw 's analysis is correct: The Matlab R2021b log4j 2.x major version bump and use of the log4j 1.x bridge is busticating SLF4M. I'm currently working on a fix (and talking with MathWorks Tech Support), but it's nontrivial. I hope to have this fixed in a couple weeks. I do not know a workaround. Sorry for the inconvenience!

BTW, @maben-mw :

MATLAB releases prior to R2021b Update 2

Was it really Update 2, and not the original R2021b release? I can't believe MathWorks finally got around to upgrading a Java library, and they shipped it in a Update. Shakes head.

BTW, here's a list of all the third-party Java libraries that some versions of Matlab are bundled with, if anyone's curious about the details here:

https://docs.google.com/spreadsheets/d/1qL9NVwVhiA_BqX16Gr9-mMKqQ0MEOGxClGA0ms7mji0/edit?usp=sharing

MathWorks Technical Support Case #05490191 if anyone would like to hear MathWorks's side of this issue.