Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] slf4j logging configuration in eclipse

Hi all,

I want to open a discussion about slf4j logging configuration in eclipse. :)

For those not familiar with slf4j, see [1].

Currently, several eclipse packages/components use slf4j for logging.
Since slf4j is just a logging facade, if there isn't any logging framework supported by slf4j "available", the logging defaults to noop. There are several logging frameworks supported by slf4j (all major ones), but only one should be available/used in a JVM. Depending on the available logging framework and how that framework is configured, the logging behavior can be quite different. If more than one logging framework is available, slf4j picks one (pretty much randomly). That can cause problems and it almost forces each eclipse component to load and configure a specific logging framework. Which can be quite bad... conflicting logging frameworks, configurations, etc. As the number of components that use slf4j increases, the problems will just multiply and it may become a nightmare to handle and configure slf4j logging.

Add generic support for slf4j logging at platform level. That requires two things: - Choose a logging framework to be used by default - I propose logback - for those not familiar with logback, see [2]
- Provide default configuration for the chosen logging framework
Currently, the m2eclipse component provides an optional bundle that loads and configures logback for slf4j in eclipse. The bundle is pretty generic and it provides the following functionality:
- Loads logback as logging framework for slf4j
- Default logback configuration if logback configuration was not provided already through one of the standard logback configuration mechanisms - see [3]
The default configuration:
- Provides a log file destination
- Pipes the logging into the console if -consoleLog is specified
- Pipes the WARN and ERROR logging into the eclipse log
- Pipes the logging into MavenConsole - this part is a little bit specific to m2eclipse. On the other hand, the MavenConsole acts more like a console viewer and it could be easily re-factored to not be maven or m2eclipse specific.


Best regards,

Back to the top