You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hemanth Setty <hs...@buildview.com> on 2002/07/03 17:02:32 UTC

Cannot use an extended logger with the ValidationForm

Hello,

I have extened the Logger class to provide a custom logging mechanism.
(com.xxx.yyy.MyLogger) When I try to use this logger with a class extended
from ValidationForm (com.xxx.yyy.MyValidationForm), it wont work. As the
ValidationForm creates a logger and assignes the default logger
(org.apache.log4j.Logger) to com.xxx.yyy.MyValidationForm . So when I try to
get a my custom logger com.xxx.yyy.MyValidationForm, I always get
org.apache.log4j.Logger instead of com.xxx.yyy.MyLogger. Is this a bug or is
there a way to go about it..??

Thanks
Hemanth


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cannot use an extended logger with the ValidationForm

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 3 Jul 2002, Hemanth Setty wrote:

> Date: Wed, 3 Jul 2002 10:02:32 -0500
> From: Hemanth Setty <hs...@buildview.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Cannot use an extended logger with the ValidationForm
>
> Hello,
>
> I have extened the Logger class to provide a custom logging mechanism.
> (com.xxx.yyy.MyLogger) When I try to use this logger with a class extended
> from ValidationForm (com.xxx.yyy.MyValidationForm), it wont work. As the
> ValidationForm creates a logger and assignes the default logger
> (org.apache.log4j.Logger) to com.xxx.yyy.MyValidationForm . So when I try to
> get a my custom logger com.xxx.yyy.MyValidationForm, I always get
> org.apache.log4j.Logger instead of com.xxx.yyy.MyLogger. Is this a bug or is
> there a way to go about it..??
>

All of the Struts components declare their loggers with a statement
something like this:

  Log log = LogFactory.getLog("....");

Therefore, to define your own logger, you will want to implement a custom
LogFactory implementation that creates Log instances, and then configure
commons-logging to use your factory instead of the standard one.  See the
documentation on the org.apache.commons.logging package:

  http://jakarta.apache.org/commons/logging/api/

> Thanks
> Hemanth

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>