-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuration of DEBUG logging using Eclipse bundle tracing #1366
base: master
Are you sure you want to change the base?
Conversation
Eclipse uses bundle tracing in the launch dialog to configure OSGi DebugOptions. This enhancements adds support for configuring debug logging using an key ending with '/debugLog'.
@guw I'm not quite sure this is the right approach, since you can open the |
@laeubi I'm using the M2E Logback support outside of M2E for other plug-in development. It's so much better to have SLF4J API available without worrying about I agree that it's not a use case for M2E. Would it still possible to allow this in the logback config? |
Only reading a system property in the logback config would be fine for me. |
@HannesWell With this change you wouldn't need to set the system property at all. It's only used as an "implementation detail". Just the Debug logging can also be enabled in the UI. For example, the following would enable DEBUG level for |
m2e uses logback only internally (or at laest is should do so) so I don't see how this can conflict? As said, everything is printed to the |
It's the configuration that conflicts. Requiring other plug-in developers to ship their own configurator will lead to a situation where M2E's log output can become disabled. Thus, having the ability to plug into M2E Logback configuration allows to mitigate the situation. The use of Logback is not exclusive to M2E. It's a logging system anyone can use (together with SLF4J API).
Agreed. Question remains whether configuration of log levels via Eclipse Tracing tab is something M2E developers find useful.
That's not how Eclipse plug-ins and marketplace works. Eclipse users are allowed to install things freely from the marketplace. I am trying to help plug-ins work nicely together for a smoother experience. |
I don't really get what you want to archive. The logback used by m2e is exclusively for m2e is it not meant to be shared / reused by others. This is because m2e has an embedded maven what uses slf4j as an implementation detail, as it is an implementation detail of m2e that is uses logback as its (internal) backend. So for the default case (Eclipse) there is the maven console view you can open and see the output and you don't need to configure anything. If you don't want that (e.g. in a custom product / library) you can supply an own fragment and replace what m2e does. Beside that, binding anything to |
Oh I am not targeting M2E users. I've added this as a helper for plug-in developers. Anyway, it seems that your definition of "default Eclipse" is very narrow and excludes the plug-in ecosystem. In such a broader ecosystem Logback/SLF4J is only an implementation detail of M2E until a users installs another plug-in which brings its own Logback Configurator implementation along. It's ok if that doesn't seem to bother M2E and the PR is not needed. |
From what you explained just providing the system property seems to be a good compromise to me. It gives you a point to hook into and the code can be added to your Plugin where it is really used. |
I'm sorry but its still not clear what type of plugins you are referring to?
So if you want to use the logback backend for general purpose for general purpose plugins you should not use So to summarize:
|
@guw I wonder if it wouldn't actually be better for your case if the m2e-logback configuration would be modular and would be applied on top of an existing application configuration (if present). Logback can also be configured dynamically in code and I could check if that would be possible as intended. |
I need two things:
I am not sure if the dynamic Logback configuration would allow the same capabilities of what M2E needs. M2E's default configuration is pretty good IMO. |
But what kind of plugin is it? A Maven-Plugin? Then m2e-logback would be the right choice. If not m2e-logback is simply they wrong place, m2e does not offer generic slf4j binding to the eclipse platform as we can't afford managing all the complications (where some you already have mentioned here), in such a case you should ask for generic logging support (with whatever back-end) at the eclipse.platform project, e.g. there was a discussion already here: |
Sorry for the late reply, but I was busy with other tasks. Since I'm about to perform a release I submitted your commit that only changes m2e's logback configuration (your second point) in #1399. This will allow you to apply the other changes of this PR in your plugin to achieve the desired goals. |
Eclipse has a nice feature in its self-hosting the launch configurations which allow to enable tracing (debug output). However, bundles need to check the
DebugOptions
programmatically and then write toSystem.out
. This change enhances the configuration of Logback to allow two things.-consolelog
is specifiedDEBUG
for any DebugOption key with a/debugLog
suffix