logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: No Virtual Destructor for LoggingEvent: msg#00035

apache.logging.log4cxx.user

Subject: Re: No Virtual Destructor for LoggingEvent


On Dec 9, 2004, at 7:53 PM, Barak Simon wrote:


Because I need the information (an event-id) to be on a *logging-message* level,
not a thread or global.

Using MDC (if at all possible) for pushing a per-message id (those ids are kept in an internal configuration file and are mapped to
a level and a format string, so that production support can easily change them) seems a large overkill.
Why we need to log these ids is of course a different matter altogether (we need these ids in order to generate (together with the full logger-name) a unique event-id
in order to populate an internal syslog format)

In all events (no pun intended), as long as the properties map inside LoggingEvent will keep being supported in further releases, I can probably use it
quite easily, and assumingly with a lesser overhead than an MDC-based solution.



That situation sounds very similar to an approach that I've used for localization of log messages (http://www.mail-archive.com/log4j-user@xxxxxxxxxxxxxxxxxx/ msg00479.html) in a project using log4net. If you were careful on how you constructed your messages (for example, start with fixed content instead of variable content, did not allow your conversions to be affected by the default locale), you could create a fairly efficient localization (or in your case customization) mechanism by having a layout that would match the "generic" message and transform it into an appropriate localized content based on an external document containing regex patterns and substitutions.

Since all that information was already embedded into the rendered message, it did not require any changes to the API or hacks to the dispatcher. Just a well designed layout implementation that used a hash map to narrow the considered regex's to avoid brute force searches.

If there is enough info in the logging event to generate what you need, then it is simplest to generate at the layout or appender instead of trying to generate it before it hits the dispatcher and add it to the logging event. If there isn't enough info in the message already, then you need to have some mechanism to add it which is where I'd look at using the MDC or NDC, but could also be accomplished in several other ways.






<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo