using apache tomcat's logger

M

marvind

Hello,

I have a web service that uses logging. I have a separate logger for my
web service in a helper class as follows:

private static Logger logger = Logger.getLogger("MyClass");

private static void initializeLogger() throws IOException {
String pattern = "%d{dd/MMM/yyyy HH:mm:ss.SSS},%M,[%t] %m%n";
PatternLayout layout = new PatternLayout(pattern);
DailyRollingFileAppender appender = new
DailyRollingFileAppender(layout, props.getProperty("LogFileName",
"Mylogs.log"), "'.'yyyy-MM-dd");
logger.addAppender(appender);
}

It looks this function is called every time a request hits apache
(since the classes are loaded all over I think). I would like to reuse
the logger apache tomcat uses. Is this possible? If yes, I can have
separate settings for each web service simply by having a
log4j.properties in the WEB-INF\classes directory?

I noticed that any System.err.println or System.out.println messages
are redirected to file.

Thanks,
mar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top