Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [hudson-dev] [Hudson-Dev] Re: Questions and ideas for JSR330 plugins

2012/2/8 Jason Dillon <jason@xxxxxxxxxxxx>:
>
> My suggestion is that if you want to implement a feature in Hudson to allow users to easily select what level loggers are configure with, would be to implement a component to allow plugins to describe their logger categories and map them relevant details.  Then write a management link page to show the details from the description components and facilitate users changing them.
>
> I highly recommend this route vs. suggesting that plugins use a single logger or by forcing plugins (and classes used by plugins) to follow some naming scheme (which 3rd-party tooling is likely to not support anyways).
>
> public interface LoggingDescriptor
> {
>    String getName();
>    String getDefaultLevel();
>    String getDescription();
>    String getPluginId();
> }
>
> Plugins can implement as many of these as they want:
>
> @Named
> @Singleton
> public class MyPluginInternalLoggingDescriptor
>    implements LoggingDescriptor
> {
>    public String getName() { return "some.package.myplugin.internal"; }
>    public String getDefaultLevel() { return "INFO"; }
>    public String getDescription() { return "Internal logging for MyPlugin"; }
>    public String getPluginId() { return "myplugin"; }
> }
>
> And continue to use loggers as they would normally using the class-name of the component (or current class for sub-class support).
>
> Then in the management thingy, inject:
>
> List<LoggingDescriptor> loggingDescriptors;
>
> Sort by name, and then render the table with options to configure the logging.

I like this idea :-) throw in some sugar coating on the management
page so the user can easily enable all loggers for a given plugin e.g.
group by getPluginId();


> I feel like I could have already written this in the time its taken for me to respond to all of the emails over it :-P

Then why didn't you, what better way to show your point than a working
prototype ;-) ;-)

Best regards
Henrik


Back to the top