clightning4j / JRPClightning

:zap: Java framework for C-Lightning to work with the RPC interface, and also the library simplifies the work to develop custom plugins with Java, Kotlin, and all the languages that supports the Java dependencies :zap:
https://clightning4j.github.io/JRPClightning/
GNU General Public License v2.0
16 stars 9 forks source link

build: remove logback.xml from release jar #82

Open theborakompanioni opened 1 year ago

theborakompanioni commented 1 year ago

The current jar includes a logback configuration file.

If a downstream consumer also defines a logback.xml, logback will complain about it on stdout, which makes cln killing the plugin. This happens even with <root level="OFF"> and no console appender defined.

11:19:14,443 |-INFO in LoggerContext[default] - Found resource [logback.xml] at [file:/home/user/workspace/tapplication/build/resources/main/logback.xml]
11:19:14,443 |-WARN in LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
11:19:14,444 |-WARN in LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/home/user/workspace/application/libs/jrpclightning-0.2.4-SNAPSHOT.jar!/logback.xml]
11:19:14,444 |-WARN in LoggerContext[default] - Resource [logback.xml] occurs at [file:/home/user/workspace/application/build/resources/main/logback.xml]

Context: https://stackoverflow.com/questions/3401051/suppress-all-logback-output-to-console Also: https://mailman.qos.ch/pipermail/logback-user/2010-August/001717.html

Logback only outputs its status messages when there is a warning or error - in this case Logback thinks that you have two logback.xml files on the classpath.

An additional side effect is that a clightning4j dir is created in the users home directory. Would it be possible to exclude the logback.xml file in the release builds?

vincenzopalazzo commented 1 year ago

Would it be possible to exclude the logback.xml file in the release builds?

I guess yes, but I need to see how I can do it with the current grade plugin, I guess this is the code that should include the fix https://github.com/clightning4j/JRPClightning/blob/master/gradle/release.gradle#L19

theborakompanioni commented 1 year ago

Would it be possible to exclude the logback.xml file in the release builds?

I guess yes, but I need to see how I can do it with the current grade plugin, I guess this is the code that should include the fix https://github.com/clightning4j/JRPClightning/blob/master/gradle/release.gradle#L19

I guess one can just include something like the following lines to the jar task in build.gradle:

    jar {
        exclude('logback.xml')
    }

But let's first consider whether it really makes sense or if some other approach is better suited. ; -)