saalfeldlab / paintera

GNU General Public License v2.0
99 stars 17 forks source link

Set log level at run-time #386

Closed hanslovsky closed 4 years ago

hanslovsky commented 4 years ago

At the moment, it is impossible to set the log level at run-time. Paintera depends on slf4j-api and not on a specific implementation and the slf4j-api does not expose a way of setting the log level at runtime. Currently, a slf4j implementation has to be added to the classpath at runtime, slf4j-simple in the paintera-cmd and the log level can be set only at start-up by setting appropriate JVM environment through -Dorg.slf4j.simpleLogger..... The paintera project is not intended to be a library but an application (core features can be extracted for re-use, e.g. saalfx, and it would thus make sense to add an explicit to an slf4j implementation. Of all the slf4j implementations, only logback exposes API to change the log level programatically, to the best of my knowledge.

I suggest:

  1. Use explicit sl4fj-logback dependency
  2. Add command line argument --log-level to set log level for root logger/specific classes
  3. Add UI elements to control log level
  4. Remove slf4j-simple from paintera-cmd
  5. (Optional) If possible with logback: Add option to specifiy log target, i.e. stdout, file, or both.
hanslovsky commented 4 years ago

Fixed in #387