On Tue, 2002-12-10 at 16:31, Wendy Smoak wrote: > > 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! > > AFAIK, this has nothing to do with log4j, but it should have caused the > stuff that the container is logging to go to the file you specified. > But... > shouldn't 'Context' be capitalized? Not sure if that matters, but since > it's not working, I would capitalize it and try again.
1)I was thinking that the configurations weren't case sensitive since
they are XML elements, but after I move <context> to <Context>, it
created the log file I was expecting.
>
> Now, on to log4j:
>
> > 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 haven't done anything with contexts or resources in order to get log4j
> working, so I'm not sure if that's another way to do this or if it's
> just
> not necessary.
>
2) If I didn't included the log4j.properties, I was getting only this
warning message, and no output of any log:
"
log4j:WARN No appenders could be found for logger
(PT.ptinovacao.ngincare.service.NGINCareImpl).
log4j:WARN Please initialize the log4j system properly.
"
> How are you using this logger? I'm using commons-logging on top of
> log4j.
> So in my classes, I have:
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> //replace "ClassName" with the actual class name:
> private static Log log = LogFactory.getLog( ClassName.class );
> //then to write a message:
> log.debug( "a debug message" );
>
3)Well, I'm using only the log4j!
"
...
import org.apache.log4j.Logger;
...
private static Logger logger;
static {
logger = Logger.getLogger(NGINCareImpl.class);
}
...
logger.info("testing");
...
"
> When you say it's not working... are you not seeing *any* logging
> messages,
> or seeing them in the wrong format? I was able to confirm that my
> properties file was being used by changing the ConversionPattern and
> looking
> to see if the output changed.
>
4)I get the output but not in the expected log file! I was hoping that
the <Logger> element could specify the destination, and the log in
application through log4j just would define the format and things like
that. Since I move <context> to <Context> (1), it started to log ok.
[THE PROBLEM NOW]
5)now I get the log of my web application generated by the container in
the specific log file, but the log I use through log4j appears in
catalina.out!! How can I redirect this log also to the specific file??
thnaks,
Pedro Salazar.
--
pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
key id: D803BC61
signature.asc
Description: This is a digitally signed message part
