[slf4j-dev] [Bug 76] Endless recursion in Marker.contains in case of recursive Marker hierarchy and Marker that is *not* contained.

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Wed May 28 23:51:01 CEST 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=76





------- Comment #4 from joern at huxhorn.de  2008-05-28 23:51 -------
No, I didn't really stumble over the problem itself in a "real" application.

I was implementing a dumbed down logback-event-DTO as I suggested in
http://bugzilla.qos.ch/show_bug.cgi?id=134 as well as an
XML-Serializer/Deserializer* for logging-events (you may take a look at the
schema at http://lilith.sf.net/schema/logging/10/LoggingEvent.xsd if you are
curious) for my log viewer and was wondering what would happen if such a
recursion would happen in logback/slf4j.

I handled this situation in XML by using references in case of recursive
markers since such a situation *could* happen.

As far as I understand markers are supposed to be used for stuff like
benchmarking so profiling code can be turned on/off globally as needed - which
is really neat :)

I had real problems to think of a reasonable use case for hierarchical markers
at all.

My guess was something like the following structure:
- Module1
  - Benchmark
- Module2
  - Benchmark
so it would be possible to selectively enable/disable profiling for modules...

...but this wouldn't work since markers are global which means that Module1
would always contain Benchmark after the structure has been initialized.

The other way around, e.g.
- Benchmark
  - Module1
  - Module2
wouldn't work, either, because then Benchmark would always contain both
modules, regardless if the code is called in Module1 or Module2...

The only chance I see for a functionality like that is to use something like
- Module1-Benchmark
  - Benchmark
  - Module1
- Module2-Benchmark
  - Benchmark
  - Module2
which would show that ModuleX-Benchmark must not contain any other stuff beside
benchmarking, i.e. no logging of e.g. caching or transaction. Those would
require a similar structure like
- ModuleX-Caching
  - Caching
  - ModuleX

Based on my own confusion I guessed that it's quite reasonable to assume that
other people are probably confused, too, and would therefore eventually create
a recursive structure by mistake.

I implemented LoggingEvent and BasicMarker DTOs because 
1) I needed a public c'tor of BasicMarker that wouldn't change the global
marker hierarchy of my log viewer, i.e. just working with markers, not using
them "as markers".
2) Equals needed to work in that case, too.
3) I wanted to omit the formatted message from the serialized event to save
some bytes on transfer.
4) Some other stuff... :)

Feel free to send me an email if you'd like to take a look at Lilith. I'm still
fixing some glitches and administrative tasks that prevent a GPL release right
now...

Joern.

* I need the XML structure so I can receive events from other languages like
C#. Flash, JavaScript, too.


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the slf4j-dev mailing list