[slf4j-dev] Usage of Markers

ralph.goers @dslextreme.com rgoers at apache.org
Fri Jun 5 17:59:03 CEST 2009


On Fri, Jun 5, 2009 at 7:00 AM, Szel, Zoltan <Zoli.Szel at morganstanley.com>wrote:

>   >Yes, the appender needs the data. In the Appender just do
>
> >EventData data = new EventData(event.getMessage());
>
> I see but performance concerns me a bit here: Serializing out a
> Map<String,Object> instance to xml and recreating it at the appender level
> will perform very poorly  and completely unnecessary. I also want the
> messages to be logged as they would be normal log messages but this way the
> message would be an xml message which is not what the user passed to me.
>
Yes. Unfortunately the LocationAwareLogger can't pass the arguments to
Logback so it had to be done this way to get the location information. This
isn't always essential though so an alternate method could be added that
allows the EventData object to be passed through. Then the appender would be
written to use the EventData if it is present and serialize the message if
it is not.

>
>
> > making a Marker a heavyweight object.
>
> I do not want to put any logic in there. It would be a simple
> JavaBean(except the fact it implements Marker ;-), nothing more.
>
I understand. I am just uncomfortable with Markers being used that way.

>
>
> Regards,
>
> Zoltan Szel
> *Morgan Stanley | IDEAS Practice Areas
> *Lechner Odon fasor 8 | Floor 07
> Budapest, 1095
> Phone: +36 1 881-3978
> Zoli.Szel at MorganStanley.com
>
> *From:* dev-bounces at slf4j.org [mailto:dev-bounces at slf4j.org] *On Behalf Of
> *Ralph Goers
> *Sent:* Friday, June 05, 2009 3:32 PM
> *To:* slf4j developers list
> *Subject:* Re: [slf4j-dev] Usage of Markers
>
>
>
>
>
> On Jun 4, 2009, at 7:37 AM, Szel, Zoltan wrote:
>
>
>
>    > The issue is in what the benefit is in having Markers for each of the
> various kinds of alerts
>
> There would be only one Marker implementation which would contain any
> information required(alertkey, level1/level2 classification etc) to send an
> alert. This would allow the flexibility to send different alerts with the
> same API(they can provide defaults, but it would not be enough given that
> different infrastructure components will send alerts with different
> properties).
>
>
>
> >If you check out the SLF4J extensions you will find an EventLogger class
> that is meant to do this kind of >thing. It uses a Marker to categorize the
> log record as an Event. It then uses a companion EventData class to >capture
> the specific data related to the event.
>
> I have checked it out and what I have found is that the EventData is simply
> logged as an xml via an SLF4J logger. This is insufficient for me because
> the companion data needs to be available in the appender itself, because he
> is the only one who knows how to interpret  them.
>
>
>
> Yes, the appender needs the data. In the Appender just do
>
> EventData data = new EventData(event.getMessage());
>
>
>
> You then have access to all your event data. It is not a big deal and is
> much better than making a Marker a heavyweight object.
>
>
>
> Ralph
>    ------------------------------
>
> NOTICE: If received in error, please destroy and notify sender. Sender does
> not intend to waive confidentiality or privilege. Use of this email is
> prohibited when received in error. Morgan Stanley may monitor and store
> emails to the extent permitted by applicable law.
>
> _______________________________________________
> dev mailing list
> dev at slf4j.org
> http://www.slf4j.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090605/25c483c6/attachment.htm>


More information about the slf4j-dev mailing list