On Tue, 5 Mar 2002, Oleg V Alexeev wrote:

> Date: Tue, 5 Mar 2002 10:43:15 +0300
> From: Oleg V Alexeev <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>,
>      Oleg V Alexeev <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Logger in ActionServlet
>
> Hello Struts,
>
>   Log variable in ActionServlet is private and get method to obtain it
>   not exist - is it a part of some ideology or a partial solution?
>
>   So what is the best way to use commons-logging - use one logger
>   instance from base class (so make log in ActionServlet protected and
>   add get method for it) or retrieve logger instance for every class
>   (so for extended version of the ActionServlet it would be another
>   logger for another classname)?
>

Although I agree with you that the ActionServlet's notion of a Log
instance should be available somehow (probably through a public getter
method), my current preference has been to have a separate named Log
instance per Struts sub-application.  That means that sub-apps (and, by
extension of the same philosophy, add-on components) should define their
own logger names.

One non-obvious facet of the SimpleLog implementation in commons-logging
1.0 (and, I *think*, in Log4J and JDK 1.4 logging as well) is that logging
level setting is hierarchical -- if a level is not set for a particular
logger name, then SimpleLog will start chopping off "." delimited
components before it uses the default level.  Therefore, you can configure
a logging level for "org.apache.struts" that applies to *all* loggers
whose names start with this, unless they are explicity set to some other
value.

>
> --
> Best regards,
>  Oleg                          mailto:[EMAIL PROTECTED]
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to