SmartGridready / SGrJava

SmartGridready communication handler in Java
0 stars 0 forks source link

Decouple Logging #56

Closed mkrebs81 closed 2 months ago

mkrebs81 commented 2 months ago

The published commhandler4modbus package ships with an implementation of Log4j, instead of just the SLF4J API. This can cause conflicts when developing applications that use the library.

My workaround is like this:

implementation (group: 'ch.smartgridready', name: 'commhandler4modbus', version: "${sgrJavaVersion}") {
    exclude group: 'SGrJava.InterfaceFactory', module: 'emfEI4Modbus'
    exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
    exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
    exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j2-impl'
}

I suggest decoupling the logging framework from the library package.

ergo-furrer commented 2 months ago

I agree, we need to remove log4j from the implementation. I plan to move the log4j dependencies to the 'testImplementation' to have the logs within the tests.

mkrebs81 commented 2 months ago

I already modified the dependencies in the https://github.com/SmartGridready/SGrJava/tree/decouple-logging branch, so you can just merge it, if you like.