Sorry it took so long to get back to you. (Was out for a couple of days.) Mike Schilli wrote: > On Thu, 22 May 2008, Craig wrote: > >> Problem is that I need to *always* send info (and "up") messages to the >> file and error (and "up") to stderr regardless of what the root logger >> level is set to. But, I also need to be able to change the stdout level >> on the fly. I don't want to set the default root level to anything less >> than ERROR, which means that only error and up will then be sent to the >> file. > > Not sure I understand why it's a requirement that the root logger's > level is not set to anything less than ERROR.
Let me start by saying that none of this is a "hard requirement". Also, I realize that I am trying to "shoe-horn" one instance of log4perl to do everything I want. The script is small and a "one-off". So, devoting a lot of time to it is kind of a waste of time. While working on the script, I was also trying to play with log4perl. > If you want INFO messages to go through, you can't close the first gate, > keep the messages out and hope that the second gate (the filter) > magically resurrects them -- that doesn't make sense. 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.) > 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. :) But, if something goes wrong (warn or "worse"), I want the user to see that. But, just in case he closes the window before I can look at it, I want the same messages saved into another file (via stderr). 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. 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. Craig ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel