OK. I agree with you in the simple case of a single Logger. The container creates and configures it based on a config file, and then passes it to the component.
Let me explain more about what's going on. It has to do with child loggers. I have a Service component which is passed a Logger via enableLogging. It then creates several child loggers (using the getChildLogger). From the configuration in its context, it then sets the children's logger priorities. So they are not hardcoded. The child loggers show different functional areas of the service's operation and so allow the user to turn on debugging/logging information in these areas. Why doesn't the container set the priorities? Well it does not know about the child loggers since they are controlled by the Service. Given that the Logger interface allows creation of a child logger, why shouldn't it contain a way to configure its priority? Also why does Avalon's LogKit allow it? If the design is wrong, I'd appreciate some pointers on handling this situation. I'm basically trying to adapt existing code to use the Avalon framework. Thanks. -Shawn Jeremias Maerki wrote: >Yes, there's a reason (if I got it right): All log configuration is done >in a config file or by the container (means: it is done from outside). >And I think logging and logging configuration (ex. Priority) are two >different concerns, so they shouldn't be in the same interface. > >So, you should not set the logging priority within your code. Having the >priorities in a config file enables you to switch on logging for a >particular category at the customer site if something goes wrong. You >can't do that if you're hardcoding the priority. > >>The org.apache.avalon.framework.logger.Logger >>interface is a wrapper for the various loggers that >>are available (ie. logkit, log4j, jdk14). However >>it is missing a setPriority method which I need. >> >>Logkit/log4J/jdk14 all provide this method in their >>Logger interface. Any reason it is not there in the >>Framework Logger? >>If not, I will provide patches to support it. >> > >Cheers, >Jeremias M�rki > >mailto:[EMAIL PROTECTED] > >OUTLINE AG >Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern >Fon +41 41 317 20 20 - Fax +41 41 317 20 29 >Internet http://www.outline.ch > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- Shawn Boyce QCOM, Inc. Quality Software is Our Business http://www.qcominc.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
