[slf4j-dev] Context for getLogger()

Thorsten Möller Thorsten.Moeller at unibas.ch
Fri Jul 2 14:27:45 CEST 2010


Hi Fred,

coming back to your posting, I have some comments/questions - inlined 
...


On Monday, June 28, 2010 10:08 PM [GMT+1=CET],
Fred <phreed at gmail.com> wrote (with possible deletions):

> I have been modifying slf4j for use on android.
> Beginning with the slf4j-android sub-project, I am adding in
> a context provider to record, forward, combine, filter and otherwise
> manage the log.
> In order to do this getLogger needs to know the current context.
> To work around this I have added a context parameter.
>
> e.g.
> import android.content.Context;
> import android.graphics.Matrix;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> public class Sample implements Cloneable {
>
> private Sample(Context context) {
> _log = LoggerFactory.getLogger(Sample.class, context);
> ...
>
> I can provide more detail if this is not clear.
Indeed  it is not clear. Could you describe a use case illustrating why 
this would be required. And maybe other options to achieve the same.

> What I want to know is if this is the best way do deal with the
> problem?
Since it is not clear to me what the actual problem is I would first try 
to understand it.

> In order to get this to work I have added some android specific stuff
> to the api/contract.
> The presumption seems to be that certain information is in some
> global variable. This doesn't seem quite right.
> What I am wondering is if there shouldn't be some generalization of
> context for slf4j.
This can all be answered if we see the complete picture.

Cheers,
Thorsten 



More information about the slf4j-dev mailing list