[slf4j-dev] Equinox Logger log(Object context, ...) methods

Libor Jelinek ljelinek at virtage.com
Fri Sep 28 10:01:49 CEST 2012


Hello Ceki,
I know that MDC is per-thread map, not bound to particular log
message. It was just a my note that it MDC could be a candidate but
it's <String, String> map.

I'm just comparing Equinox ExtendedLogService capability to attach any
Object with log message, and how this could be implemented with SLF4J
in the closest similar manner.

To your question "what Objects people pass as 'context'?", I have to
answer that it's used very rare or no at all. Also, me personally I've
not needed to use it so far. Javadoc is not specific about it too.
Equinox implementation store it as in-memory field. It is not printed
to console or file, and because Equinox doesn't have any "layouts" to
custom output, it is lost after log entry is garbage collected...

Thanks
Libor

On Thu, Sep 27, 2012 at 10:39 PM, ceki <ceki at qos.ch> wrote:
>
> Hi Libor,
>
> The MDC is not part of any log statement. (The MDC is stored as a thread
> local.) I don't see why you want to pass MDC map in the "Object context"
> parameter.
>
> What type of information do people pass via "Object context"? That's the
> question which seems most relevant to me.
>
>
>
> On 27.09.2012 22:29, Libor Jelinek wrote:
>>
>> Hello Ceki!
>> I'm think about how to correctly bridge method
>> org.eclipse.equinox.log.Logger.log(Object context, int level, String
>> msg) ([1]) to SLF4J API. Please notice a  "Object context" parameter
>> which is arbitrary object associated with log entry just being logged.
>>
>> Because MDC is conceptually <String, String> map, so only way is
>> probably use marker for to store "Object". Is it right, (Ceki)?
>>
>> Libor
>>
>> [1]
>> http://javasourcecode.org/html/open-source/eclipse/eclipse-3.5.2/org/eclipse/equinox/log/Logger.html#log(java.lang.Object,
>> int, java.lang.String)
>
>
>
>
> --
> Ceki
> http://twitter.com/ceki
> _______________________________________________
> slf4j-dev mailing list
> slf4j-dev at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-dev


More information about the slf4j-dev mailing list