Closed LordTylus closed 1 year ago
@LordTylus Lots of these combinations of slf4j and also the logging frameworks are just not compatible. They are either java 8+, or not android compatible. The errors are kind of hidden too, so can be tricky to find out why.
implementation 'org.slf4j:slf4j-api:1.7.25' implementation 'ch.qos.logback:logback-classic:1.2.3'
This combo is an example that works, pretty old I know. Your case in specific, is using something that is not available on android or the ios runtime provided by robovm. java.lang.Management. Which is not compatible with android, so definitely not going to be compatible with robovm.
You could try the log4j stuff for android, but the deployment is an aar, so youd have to extract it, and then hope they are using compatible stuff for the robovm runtime.
Issue details
Hello there,
we are currently swapping logging frameworks to get rid of a somewhat custom solution in favor of standard frameworks. After some evaluation we settled on Log4j2 via Slf4j. We use Slf4j for years now and I was under the impression swapping out the logger implementation was a small thing to do , but sadly it doesn't seem to be.
Whenever we start our app we get warnings about Slf4j not being able to find a logger implementation and that we should add Log4j-core to the classpath or use force link classes. Which we did. Its properly added to the build.gradle. We tried placing the log4j2.xml under /resources next to the xcassets and under /src/main/resources but sadly that didn't seem to do the trick.
Adding force link classes for org.slf4j. and org.log4j also doesn't help with the situation. We ensured to use Log4j 2.12.4 (which does not rely on Java8 functionality and still has the important security fixes).
We can load the classes and config manually using Class.forName() and getResourcesAsStream() for example which means they must be in the app, so I don't understand where the Problem is.
Had anyone here encountered similar problems using Log4j2?
I do have a small sample project see below
Full Conversation can be found on Gitter as well: https://gitter.im/MobiVM/robovm?at=639adc144a6ed513835a77c5
Reproduction steps/code
Use the following Project Log4jTest.zip
launch it in iPad simulator using provided .sh file.
You will see there are error messages about not loaded classes in console and logging is non functional.
Configuration
Please provide the build system, version(s), and targets affected.
Build Tools:
Versions:
Please provide the version of RoboVM, XCode and JDK used
Build Targets:
Any really. Test above is iPad Simulator, but same can be seen on actual device.