logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject RE: Persisting LoggingEvents across languages - DTD questions
Date Thu, 29 Apr 2004 19:14:27 GMT
At 11:05 PM 4/28/2004, you wrote:
>On a related note, is it time to promote log4j's DTD as the cross-language 
>DTD (and rename it), since log4cxx and log4net, log4php, log4perl all 
>support the DTD?

Good point. It's up to the rest of project members to decide (not just the 
log4j folks).

>I would also like to discuss the most recent change to the DTD to add 
>sequence number support to event as a required attribute.
>
>Is it the case that this sequence number will always be set and have a 
>useful value?

Yes, always.

>I'm not sure who will be setting the sequence number - if they're using a 
>DB appender, the sequence number will exist, but only in the database, 
>correct?

No. The sequence number is set when the event is created. Appenders that 
write events to persistent media must preserve the sequenceNumber, and in 
particular, XMLAppender and DBAppedner must do so.

>Will this sequence number be 0 in other cases? is it the responsibility of 
>the appender to set it?  If it's zero everywhere except when retrieving 
>the sequence number from the database, is it worth adding to the DTD?

Scott, look at the code. The sequenceNumber is a must have field. You were 
probably confused by the fact that the LoggingEvent constructors which are 
used to resurrect events from persistent media do not admit sequenceNumer 
as a parameter. However, sequenceNumber has a setter, so it does not need 
to be set when the event constructor is called. The setSequenceNumber can 
be called just after calling new LoggingEvent(...). Does that make better 
sense?

>Chainsaw V2 relies on a similar mechanism, but uses a 'log4jid' property 
>as the identifier.  If the property doesn't exist when it's received, the 
>property is added.  Building a namespace of properties seems odd as well, 
>but would be more flexible than modifying the DTD to support new features 
>that were used by a subset of the events.
>
>If the user is logging to a database and a file, and the database is the 
>source of the sequence number when it's sent to the database, would the 
>file have a different sequence number?

When events are stored in a DB, they will have a PK distinct from the 
sequenceNumber. The PK could be used to sequence events from multiple 
applications running on multiple hosts with skewed clocks. The PK will be 
stored in the event properties for an event resurrected from the DB. 
Resurrected events cannot be written back to the DB as events are immutable 
objects.

Thus, the the PK is available it is should be used to distinguish and order 
events, otherwise, the PK is not available, the timestamp and 
sequenceNumber should be used. The latter two are assumed to be always 
available.

I hope the above makes it a bit clearer...

>Scott

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



Mime
View raw message