| | > Remember the within-a-millisecond criteria, the | >no-two-"persons"-can-have-the-same-birthday-while-within-one "garbage | >generation" criteria, and add on to that the from the same logger | >criteria, the same level criteria, and possibly also with the same message | >criteria. You're rather far from the birtday paradox now, I feel. | > | >But still, it -could- happen. It just seems rather unlikely. | | We don't know for sure.
But you still allow the -global synchronization- to generate a LoggingEvent? | | >Look up a couple of UUID/GUID algorithms. This is actually what you're | >after, isn't it? Preferrably w/o synchronization hits. | | Any references? Some "random" hits: Google: UUID http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html http://www.ossp.org/pkg/lib/uuid/ " UUIDs are 128 bit numbers which are intended to have a high likelihood of uniqueness over space and time and are computationally difficult to guess. They are globally unique identifiers which can be locally generated without contacting a global registration authority. UUIDs are intended as unique identifiers for both mass tagging objects with an extremely short lifetime and to reliably identifying very persistent objects across a network. " http://www.doomdark.org/doomdark/proj/jug/ Java UUID Generator - JUG. http://searchwebservices.techtarget.com/sDefinition/0,,sid26_gci805876,00.html Google: Universally Unique Identifyer http://www.auditmypc.com/acronym/UUID.asp http://www.govtalk.gov.uk/gdsc/html/frames/GloballyUniqueIdentifier-0-2-Draft.htm This is the currently suggested standard: http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-05.txt .. or you could use a webservice for all LoggingEvents generated: http://kruithof.xs4all.nl/uuid/uuidgen ;-D My point is that to generate such an "UUID", the systemIdentityHashcode in addition to the milliseconds would be a very good starting point. You must take into account that the LoggingEvent object would have to actually get out of JVM scope, AND garbage collected, AND the address would have to be reused for a LoggingEvent object, -within- one millisecond, for a crash to occur. Add the Thread Id (or its hashcode). Add the message string hash. Add the level. You're now pretty much there.. Then shove in a pseudo-random 64 bit number from a ThreadLocal Random generator, and even you will have to admit that the possibility of a collision is .. well .. zero. I believe that an "UUID" consisting of .. 1) systemIdentityHashcode of LoggingEvent object on construction 2) hash of message String 3) systemIdentityHashcode of message String object on construction 4) current millis 5) Thread Id ., would be -way- more than enough. The hash of the message string is maybe "quite expensive" to calculate. However, you now have a Rather Unique Identifier (RUI) -without- the -global- multithreaded, multicontended synch hit. Endre --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]