Greetings,

I would like to configure log4j in my tomcat environment. I included a
log4j.properties in my web application inside WEB-INF/classes/. I put my
war (ngincare.war) in webapps and included a <context> for my web
application in server.xml with the following lines:

"
<context docBase="ngincare.war" debug="9" reloadable="true"
        path="ngincare">

        <Logger
                className="org.apache.catalina.logger.FileLogger"
                prefix="localhost_ngincare_log."
                suffix=".txt"
                timestamp="true" />
</context>
"
But unfortunately my log is still being appended in catalina.out!

My log4j.properties is defined like this:
"
log4j.rootLogger=,NGIN
log4j.category.PT.ptinovacao.ngincare=NGIN
log4j.appender.NGIN=org.apache.log4j.ConsoleAppender
log4j.appender.NGIN.layout=org.apache.log4j.PatternLayout
log4j.appender.NGIN.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
"

I don't know if my context is being really used by my web application
since I never could configure a <resource> element there! The only way I
could get a resource to work was put it inside the <DefaultContext>
element!! Could it be?

I will appreciate any help you can give.

thanks,
Pedro Salazar.

On Tue, 2002-12-10 at 07:12, Bill Barker wrote:
> 
> "Wendy Smoak" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Jacob wrote:
> > > Set up your <Context ...> entry to look something like this:
> > > <Context path="/myapp" docBase="myapp" debug="5">
> > >     <Logger
> > >         className="org.apache.catalina.logger.FileLogger"
> > >         prefix="localhost_myapp_servlet_log."
> > >         suffix=".txt"
> > >             timestamp="true" />
> > > </Context>
> >
> > Wow, nothing like it being right there in front of my face.  The context
> tag
> > for the examples does have a Logger tag-- I must have been searching for
> > 'Logging' instead.
> >
> > Thanks!
> >
> > Dan wrote:
> > > Use Tomcat log interface will make your code depending
> > > on Tomcat appserver.  What if  you want run your app
> > > on other servers in the future?
> >
> > I take it logging isn't in the servlet spec?  From another message, I got
> > the impression that the container would want to send some messages itself.
> > If there is no Logger configured for the webapp, does it just send them to
> > the console?
> 
> There is a 'log' method (serveral, actually) in the ServletContext object.
> There are also conveniance 'log' methods in GenericServlet (which most
> servlets extend, since HttpServlet does).  This works fine if all you want
> to do is to log from your servlets.
> 
> If you also want to be able to log from your Beans as well, it's not much
> help, since they usually won't have access to the ServletContext.  In this
> case you are better off with commons-logging and/or log4j.
> 
> >
> > --
> > Wendy Smoak
> > Applications Systems Analyst, Sr.
> > Arizona State University PA Information Resources Management
> >
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- 
pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
key id: D803BC61


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

Reply via email to