Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317073 - Make Logging stuff available on a per class configuration
Summary: Make Logging stuff available on a per class configuration
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: E4 (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-16 13:03 EDT by Thomas Schindl CLA
Modified: 2012-12-13 15:00 EST (History)
7 users (show)

See Also:


Attachments
Patch (9.62 KB, patch)
2010-06-16 13:03 EDT, Thomas Schindl CLA
no flags Details | Diff
patch (11.12 KB, text/plain)
2010-06-20 07:08 EDT, Thomas Schindl CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2010-06-16 13:03:48 EDT
Created attachment 172059 [details]
Patch

The current logger stuff is always logging as the logger from the ui.workbench bundle. It should be possible to create a logger configured on a per class or at least per bundle level.

The attached patch adds a ILoggerProvider service and a default implementation which creates a logger on a bundle level.
Comment 1 Oleg Besedin CLA 2010-06-17 14:53:52 EDT
First, a technical wrinkle:

		context.set("logger.bundlename", FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$
		return (Logger) ContextInjectionFactory.make(WorkbenchLogger.class, context);

This messes up context. Better to create child and add the "logger.bundlename" to the child.

Now, that said, why not change WorkbenchLogger methods to take a bundle? Or, better yet, add a method that takes Status as an argument?

-----

Let's not get carried away here; let's do only what's going to be needed in 1.0 release. The logging in general needs to be worked on. That did not happen because of the lack of resources, but it certainly needs to be re-done.
Comment 2 Thomas Schindl CLA 2010-06-20 07:05:50 EDT
(In reply to comment #1)
> First, a technical wrinkle:
> 
>         context.set("logger.bundlename",
> FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$
>         return (Logger) ContextInjectionFactory.make(WorkbenchLogger.class,
> context);
> 
> This messes up context. Better to create child and add the "logger.bundlename"
> to the child.
> 

ok.

> Now, that said, why not change WorkbenchLogger methods to take a bundle? Or,
> better yet, add a method that takes Status as an argument?
> 

well because then you need to reread the configuration (which log-level, ...) everytime and you need to pass on the bundle all the time.

When looking at other frameworks like e.g. log4j they do their logger retrieval on a very similar way.


> -----
> 
> Let's not get carried away here; let's do only what's going to be needed in 1.0
> release. The logging in general needs to be worked on. That did not happen
> because of the lack of resources, but it certainly needs to be re-done.

So are you +1 on the change? I agree that we need to work on it in 4.1 but the current status is that it is unusable so IMHO the patch at least gives people some kind of logging they can use.
Comment 3 Thomas Schindl CLA 2010-06-20 07:08:41 EDT
Created attachment 172289 [details]
patch

Implementing Olegs adivice to create a child context
Comment 4 Thomas Schindl CLA 2010-06-22 14:08:18 EDT
any news? I need a +1 to commit to rc1
Comment 5 Boris Bokowski CLA 2010-06-22 17:50:43 EDT
We decided that for RC1 we won't be requiring +1s, to save time. We're still changing code at a high rate. Unless this change would break existing code I'd say just release it.
Comment 6 Thomas Schindl CLA 2010-06-23 07:17:25 EDT
released the change to HEAD