On Tue, 27 May 2008, Craig wrote: > Sorry, I didn't understand the internals of the library. I didn't > think of it as a series of gates. Rather, I thought each logger > category was independent of the others. Reading the docs more > completely, it is obvious that isn't true. (Inheritance wouldn't work > if that were true.)
Right, loggers in different parts of the hierarchy are independent of each other, while loggers that share the same lineage inherit from each other, you get this 'message bubbling up' effect. Filters, on the other hand, are separate from loggers and are associated with appenders to give them the opportunity to make a last deciding call on whether to log a message approved by a logger or not. > > Why aren't you simply setting the logger to the lowest level you're > > interested in (INFO if I understood correctly) and handle the > > messages you don't want in the appenders with a threshold setting? > > There are 3 distinct logging parts: > 1. all warnings to stderr > 2. all warnings to the user (stdout) > 3. ongoing logging of what the app has done > > I would like a file that contains data on what the app did, what it > touched, how long it took ,etc. (FYI, this is #3.) But, the user > shouldn't be shown a bunch of data that he a) doesn't care about and b) > doesn't understand. It would probably confuse him. :) No problem at all, that's exactly what you can do with filters. > This is all easy. The twist is that I would like to be able to pass in > a "verbosity level" and with that change the log level for just > stdout. That makes it much easier for me to debug problems if/when > they arise. I usually do that by switching to a more chatty log4perl configuration when I see that the user specified the '--verbose' or '-v' option. You can either have a separate log4perl config file or use a string to initialize log4perl. > While thinking about this over the weekend, I figured this may be > possible by setting a filter function on stdout. That function would > look at the verbosity level. > > Then stderr and the app log would have their own filters set to WARN and > INFO. Then the root logger would be set to TRACE. Seems like a lot of > overhead, but it is ONE way to get a fair amount of configuration pretty > simply. That's the way to go! :) -- Mike Mike Schilli [EMAIL PROTECTED] ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel