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: Question on logger hierarchy: msg#00021

apache.logging.log4cxx.user

Subject: Re: Question on logger hierarchy


On Sep 8, 2004, at 7:38 AM, Robert Haschke wrote:

Dear developers,

I'm new to log4* and I'm wondering how I can achieve the following goal:

I want to have a top level logger, logging to cerr with a level WARNING.
Below may be several other loggers with their own appenders, layouts and
logging levels. If I trigger an error or warning on these descendant
loggers, the message (if enabled at all) should be forwarded to the
top-level logger, logging to cerr. I think, this is the purpose of the
logger hierarchy.
My attempt to this failed, because all messages enabled at the
descendant loggers are forwarded to its ancestors, which do not check
the log level anymore. Why should this behaviour be useful?

It allows you to lower the threshold of a specific child logger while suppressing all other loggers. It is an established log4j behavior and not subject to change. The scenario is discussed in the section "Setting the level of a logger" (pg 55) of "The complete manual log4j", but I didn't see it discussed online.

Why should I
use a logger hierarchy, if I cannot influence the logging through the
different log levels?

How can I achive my goal?


You should be able to set the threshold on the appender attached to the root logger.


In future releases, it would be very convenient to have logger methods,
which allow printf-like formatting.


I'd like to keep the LOG4CXX_level macros as simple as possible (and simpler than they are now). I don't think printf is desirable since so many had things can happen if the format specifiers don't match the arguments. However, making it simple to do logging involving operator<< is a worthwhile goal, something like:

LOG4CXX_DEBUG_STREAM(logger, "The current count is " << count);

which would be equivalent to something like:

LOG4CXX_DEBUG(logger, ((std::ostringstream)() << The current count is " << count).str());




<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