eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
40 stars 21 forks source link

Unify logging output to use log4j2 in Eclipse product #187

Closed ndoschek closed 1 year ago

ndoschek commented 2 years ago

If the ModelServer is packaged as eclipse product and run as Eclipse IApplication (e.g. in the coffee-editor) the logging should be unified to use log4j2 exclusively.

Currently, there are issues with different logging output streams from slf4j (e.g. the Javalin base uses slf4j logging for the startup info). Also, if the product is started via the equinox launcher from the client, errors are logged regarding the missing slf4j-simple dependency.

For the classic java jar product, we could overcome this by adding the Apache Log4j SLF4J Binding that redirects slf4j to log4j.

ndoschek commented 1 year ago

As it turned out, using the modelserver as Java jar product, there might be a problem with aggregating multiple log configurations. I reworked the log configuration with #229 for jar products.

For the Eclipse products, the problem is a bit more complex, as it seems that in case of p2 the classloader cannot grasp the responsible LoggerFactory/LoggerBinder correctly. It is possible to redirect the underlying jetty server logs to log4j2, but the javalin logs are not correctly redirected (which are for example the startup infos or the devLogging). We will have to investigate this a bit further.

ndoschek commented 1 year ago

We do not continue the work on trying to fix it for the use case of running the Model Server as eclipse product (via equinox for example). Alos, trends go more towards pure maven builds and running backend services as JARs (e.g. for the coffee-editor https://github.com/eclipse-emfcloud/coffee-editor/issues/456).