Hi,
I just switched from Tomcat 5.5 to Tomcat 6 on an Ubuntu server. I'm
trying to use log4j with this configuration:
log4j.appender.R=org.apache.log4j.ConsoleAppender
log4j.appender.R.target=System.out
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
This was not working, so I searched documentation and learned about:
<Context swallowOutput="true"> ... </Context>
However, this swallowOutput doesn't seem to work. I tried putting
this in several places:
1) in the sever-wide context.xml, which already exists and has a
<Context ...> element. (On my system, this fil is in /etc/tomcat6).
2) There was no host-specific one, so I added the file
/etc/tomcat6/Catalina/localhost/context.xml with the contents:
<Context swallowOutput="true"/>
Note that ${CATALINA_HOME}/conf is a symlink to /etc/tomcat6, so when
the documentation refers to the locations for these files, I am pretty
sure I know which ones they're talking about.
3) Just to exhaust all possibilities, in my webapp's META-INF, I
created a context.xml file with the same contents.
None of these three things had any effect. I tried it both with log4j
and, to rule out that log4j was the problem, tried some
System.out.println and System.err.println here and there. Near as I
can this output goes nowhere.
I would REALLY like my log4j output to go to localhost_<datetime>.log.
Otherwise, I think I have to do some screwing around with the
security manager in order to use something like the
RollingFileAppender.
I tried to follow http://tomcat.apache.org/tomcat-6.0-doc/logging.html
as best I could, including using tomcat-juli.jar from output/extras as
well as adding in tomcat-juli-adapters.jar. I'm not sure if that
really applies, but was wondering ....
BTW the logger itself more-or-less seems to work. I determined this
by doing something "wrong" just as a test: I called log4j's
BasicConfigurator.configure() to see what it would do. I got log4j
logging output, but I would get duplicate log entries the more times I
reloaded my app. I quickly figured out that I need to get the logger
as a static resource in whatever class wanted to log, e.g.
private static Logger logger = Logger.getLogger(servletEventListener.class);
Thanks,
--Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]