[logback-dev] Small LoggingEvent suggestion

Ceki Gulcu ceki at qos.ch
Fri Mar 20 15:28:44 CET 2009


Hello Joern,

As much as I don't enjoy declining your suggestions, given that
LoggingEvent is the central class in logback-classic, I don't see how
supporting j.u.l. justifies fattening the LoggingEvent class.

In particular, why do you say that threadId is worthy additional data?
 From logback's persperctive (setting jul aside for a moment) what new
informaiton is in threadId that is not in threadName?


Joern Huxhorn wrote:
> Hi Ceki and sorry for the late reply on this one...
> 
> On 04.03.2009, at 18:38, Ceki Gulcu wrote:
> 
>> Hello Joern,
>>
>> The javadocs for getId state:
>>
>> public long getId()
>>
>> Returns the identifier of this Thread. The thread ID is a positive 
>> long number generated when this thread was created. The thread ID is 
>> unique and remains unchanged during its lifetime. When a thread is 
>> terminated, this thread ID may be reused.
>>
>> Thus, the id is not guaranteed to be unique either...
> 
> That's true but it is unique, at least, at the time of the LoggingEvent 
> creation which would be sufficient I think.
> 
> The reason I'm asking this is that I'm looking into import of various 
> logging events into Lilith and I had to realize that jul is sending 
> *only* the thread id, *not* the name of the thread - which is pretty 
> pointless if you ask me.
> 
> Therefore I saw the requirement to support more than just the name to be 
> able to import jul events lossless concerning the contained info.
> 
> I created a ThreadInfo class that contains the following:
> 
> threadName
> threadId
> threadGroupName
> threadGroupId (this is System.identityHashCode(threadGroup) since there 
> is no such thing as a ThreadGroup id)
> 
> All of those are optional.
> In case of current logback-classic only threadName is filled in, in case 
> of jul only threadId.
> 
> At the moment, my LogbackLoggingAdapter is filling in the additional 
> info itself which means that you'll get all of the above if you use my 
> appender. I think it's worthy additional data.
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the logback-dev mailing list