如何在 Windows 上使用 Tomcat 6 设置 Logback

发布于 2024-12-22 20:02:09 字数 826 浏览 6 评论 0原文

我在 Windows 桌面上安装了 tomcat6 用于测试目的。目前 webapps 文件夹中没有添加任何内容,只是正常的 tomcat 启动。生成以下日志文​​件:

catalina.2011-12-24.log
host-manager.2011-12-24.log
jakarta_service_20111224.log
localhost.2011-12-24.log
manager.2011-12-24.log
stderr_20111224.log
stdout_20111224.log

我的问题很简单,我希望这些日志 [包括 stdout] 根据定义的大小限制进行滚动和压缩。

我已经了解了 logback 及其使用定义的策略滚动和压缩文件的功能,但我无法让它为我工作。我已在 $TOMCAT_HOME/lib 目录中复制了以下 jar:

logback-access-1.0.0.jar
logback-classic-1.0.0.jar
logback-core-1.0.0.jar

一些站点建议也应添加这些库:

jul-to-slf4j-1.6.4.jar
slf4j-api-1.6.4.jar

我已尝试在 $TOMCAT_HOME/conf 和 $TOMCAT_HOME/lib 中复制 logback.xml,但无法使其工作。

如果有人可以帮助我,我将非常感激,最好可以为我提供一个 logback.xml 和 jars/xml 位置,应在其中复制这些文件以使其工作。

PS我没有在tomcat中部署任何web应用程序,它只是基本的tomcat设置。

I have tomcat6 installed on my Windows desktop for testing purpose. At the moment nothing is added to the webapps folder, just the normal tomcat start up. Following log files are produced:

catalina.2011-12-24.log
host-manager.2011-12-24.log
jakarta_service_20111224.log
localhost.2011-12-24.log
manager.2011-12-24.log
stderr_20111224.log
stdout_20111224.log

My problem is simple, I want these logs [stdout included] to be rolled and compressed on the basis of defined size limit.

I have read about logback and its capabilities to roll and compress files with defined policies, but I have not been able to make it work for me. I have copied following jars in $TOMCAT_HOME/lib directory:

logback-access-1.0.0.jar
logback-classic-1.0.0.jar
logback-core-1.0.0.jar

Some sites suggested these libs should be added as well:

jul-to-slf4j-1.6.4.jar
slf4j-api-1.6.4.jar

I have tried copying logback.xml in $TOMCAT_HOME/conf and $TOMCAT_HOME/lib, but unable to make it work.

I would really appreciate if someone can help me with this, best could provide me with a logback.xml and jars/xml location where these files should be copied to make it work.

P.S. I have not deployed any webapp in the tomcat, it just the basic tomcat setup.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柏拉图鍀咏恒 2024-12-29 20:02:09

我认为本教程可以提供帮助。 Tomcat 6 仅适用于 log....0.9.30.jar 或更低版本。 Tomcat + SLF4J + Logback

I think this tutorial can help. Tomcat 6 works only with log....0.9.30.jar or lower. Tomcat + SLF4J + Logback

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文