Hi
Does a mechanism exist through which I can access the contents of the
MessageObject (within the LoggingEvent) via the layout patterns?
For example, in my project I'm logging classes MyLogEvent to log4net rather
than strings. I intended reusing existing appenders (such as the
AdoNetAppender) to log these rather than write my own but can't see a way of
accessing my specific object's properties.
Looking at the source (v1.2.10) I couldn't see anything within the
PatternLayout that would cover this scenario, so I've added a new
log4net.Layout.Pattern.MessageObjectPatternConverter (modelled on the
PropertyPatternConverter) and wired it into the PatterLayout invoked as
%object{<object property>}.
Does anyone have any views on the desirability or practicality of such a
feature? If there's interest I'm more that happy to contribute the code and
unit tests, otherwise I'll investigate other routes.
Thanks
Matt.
- Retrieving MessageObject property values for logging... Matthew Braid
-