Anders Kristensen wrote:
| Thomas Tuft Muller wrote:
| > I probably miss a few things, but it seems like the LoggingEvent doesn't
| > contain the original Object (only the message i.e. the string version
| > (toString() of it) passed from the application. The
| LoggingEvent is passed
| > to each member of the list of PatternConverters from
| PatternLayout and ends
| > up being passed to the overrided convert(LoggingEvent) method.
| How do I get
| > hold of the original object from this point?
|
| The original Object is in the LoggingEvent. You get it by calling
| getMessage().
Not it version 1.0.4 ;) I've downloaded the latest now.
| > I certainly like the idea of having rules (patterns) for conversion of
| > different types, but I guess the PatternLayout class is no good
| for this(?)
| >
| > Any suggestions for a flexible design and some hints how to
| implement it?
[snip]
| 3. In the ObjectRenderer. This is similar to 2, but instead of asking
| the LoggingEvent to resolve an unkown conversion character to a String,
| the PatternLayout asks the ObjectRenderer associated with the logged
| Object:
|
| void format(Object msg, char conversionChar, StringBuffer sbuf);
Do you sugges the the ObjectRenderer implements this method? If this is the
case, some checking and casting must be done somewhere.
| The first argument might be the whole LoggingEvent instead of just the
| logged Object.
|
| Option 3 seems by far the best and most flexible to me, e.g.
|
| - can accommodate per-Class custom conversion characters
Yes.
| - can accommodate different per-category rendering
How? Renderers are still global or what? Do you suggest that the renderer
gets information about the category calling it in order to differentiate?
| - no need to subclass PatternLayout as in 1.
How can I call the "custom" method on the renderer if I don't subclass
PatternLayout?
Sorry for being a little thick here, but I can't see clearly how to
implement this. Thanx for all help so far!
--
Thomas
*************************************************************************
Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved.
Confidential. No liability whatsoever is accepted for any loss or damage
suffered as a result of accessing this message or any attachments.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]