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