ariel wrote:
2) Is it possible to limit the amount of rolled logged files as it can be done in the log4j ?
I am not sure, if there is already an implementation available, nor if tomcat provides one.
But some time ago i have written a simple class which is able to act as replacement for the tomcat loggers and a bridge to commons-logging - and from there to log4j. (phu, what a long way for a log-message ;-))
-- Mario
--cut-- package the.package.you.like;
import org.apache.catalina.logger.LoggerBase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
public class Logger extends LoggerBase
{
private final static Log log = LogFactory.getLog("Tomcat"); public void log(Exception ex, String message)
{
log.fatal(message, ex);
} public void log(String message, Throwable throwable)
{
log.fatal(message, throwable);
} public void log(String message, int level)
{
log(message, null, level);
} public void log(String message, Throwable throwable, int level)
{
if (this.verbosity < verbosity)
{
return;
} if (level == FATAL)
{
log.fatal(message, throwable);
}
else if (level == ERROR)
{
log.error(message, throwable);
}
else if (level == WARNING)
{
log.warn(message, throwable);
}
else if (level == INFORMATION)
{
log.info(message, throwable);
}
else if (level == DEBUG)
{
log.debug(message, throwable);
}
else
{
log.info(message, throwable);
}
} public void log(String message)
{
log.info(message);
}
}
--cut--
smime.p7s
Description: S/MIME Cryptographic Signature
