java-opentimestamps icon indicating copy to clipboard operation
java-opentimestamps copied to clipboard

SLF4J support

Open mramsden opened this issue 4 years ago • 2 comments

This is based on the conversation over on opentimestamps/java-opentimestamps#48. I have migrated the project from using java.util.logging to SLF4J. This should make it easier for those depending on this library to control the logging that is coming out of the library.

There are some changes to how the CLI application needs to be built. Now when creating the OtsCli.jar it should be built with mvn install -P cli which will activate the CLI profile. This adds Logback Classic and a basic stdout log appender configuration to the CLI jar. This will allow log messages to be emitted on the command line.

All references to java.util.logging have now been removed with SLF4J as the preferred approach. Also the tests have a dependency on Logback Classic to ensure that the correct log message is output on one of the tests.

Remaining tasks

  • [ ] Test this with an existing application to make sure that the logging can be configured as required.

mramsden avatar Nov 14 '20 17:11 mramsden

Isn't java.util.logging more agnostic so that dependent library could choose which logging implementation do they prefer?

Can't we follow @lvaccaro suggestion https://github.com/opentimestamps/java-opentimestamps/issues/48#issuecomment-715943964 remove slf4j from the lib, then maybe use logback/slf4j in the cli profile?

RCasatta avatar Nov 25 '20 14:11 RCasatta

Yep, that's probably a good idea. I'll get this updated to use that in preference to SLF4J.

mramsden avatar Nov 25 '20 14:11 mramsden