You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andreas Leitner <al...@macron.at> on 2001/08/21 18:04:05 UTC

log4j in custom tags

I want to use log4j from within a custom tag. Now, since the custom tag
will be instanciated from the jasper JVM, the logj4 properties file of
the webapp will of course not be used to setup log4j.

How can I configure log4j in a custom tag to use the same log-writer
than my web app - or how can I configure it at all to redirect output to
a certain file? It does not seem to go into the jasper.log (which I have
configured in sever.xml to be the log target for jasper)


Many thanks in advance,
Andreas


how to get the target frame

Posted by Andreas Leitner <al...@macron.at>.
Hi,

Is it possible to determine the target frame from within a Servlet (or
better Custom Tag, but I assume once, I know how to do it from a
Servlet, I can do it from a Custom Tag as well).

This information must be somewhere, or am I mistaken?

Many thanks in advance,
Andreas


Re: log4j in custom tags

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

On Tue, 21 Aug 2001, Andreas Leitner wrote:

> 
> I want to use log4j from within a custom tag. Now, since the custom tag
> will be instanciated from the jasper JVM, the logj4 properties file of
> the webapp will of course not be used to setup log4j.
> 

The tag might be instantiated by Jasper runtime (not JVM), but it will be
loaded by the webapp classloader -- as long as the tag itself is in
/WEB_INF/lib or /WEB-INF/classes.

> How can I configure log4j in a custom tag to use the same log-writer
> than my web app - or how can I configure it at all to redirect output to
> a certain file? It does not seem to go into the jasper.log (which I have
> configured in sever.xml to be the log target for jasper)
> 

Remember that Log4J is *totally* independent of Tomcat (and Tomcat knows
nothing about your use of it).  Therefore, you won't be able to use Log4J
to log to Tomcat's log files (unless you do some pretty intricate work to
modify Tomcat to use Log4J itself, which is out of scope for this
discussion).

If you just want to log to Tomcat's log files, the easiest thing to do is
call
ServletContext.log() in your webapp.

> 
> Many thanks in advance,
> Andreas
> 
> 
Craig