spymemcached - 是否可以禁用日志系统?

发布于 2024-08-28 11:34:37 字数 183 浏览 3 评论 0原文

我们正在使用spymemcached memcached客户端,但我们没有发现如何禁用日志系统。

我们如何在运行时将当前日志系统更改为 log4j 或 sl4j 之类的系统?

注意:我们可以传递一些虚拟机参数,但问题是:我们无法更改服务器配置。是否可以在运行时传递这些虚拟机参数?如果可以的话,我们怎样才能做到这一点呢?

we are using the spymemcached memcached client but we didn't discovered how we could disable the logging system.

How could we at runtime change the current logging system to something like log4j or sl4j?

Notice: We could pass some VM arguments, but the problem is: we can't change our server configuration. Is it possible to pass these VM arguments at runtime? If possible, how could we do that?

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

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

发布评论

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

评论(2

小嗲 2024-09-04 11:34:37

在创建 MemcachedClient 对象之前,我通过执行此操作停止了对 catalina.out 的过多 Tomcat 日志记录:

System.setProperty("net.spy.log.LoggerImpl",
  "net.spy.memcached.compat.log.SunLogger");
Logger.getLogger("net.spy.memcached").setLevel(Level.WARNING);

I stopped excessive Tomcat logging to catalina.out by doing this before creating the MemcachedClient object:

System.setProperty("net.spy.log.LoggerImpl",
  "net.spy.memcached.compat.log.SunLogger");
Logger.getLogger("net.spy.memcached").setLevel(Level.WARNING);
爱人如己 2024-09-04 11:34:37

我知道这是一个老问题,这个解决方案在运行时不起作用,但我遇到了类似的问题,只找到了这个问题。您可以找到一种通过 tomcat 配置文件设置spymemcached 日志记录级别的方法 这里

重要部分:

简短总结如何使spymemcached更加安静:

将以下内容添加到$CATALINA_HOME/bin/catalina.sh

CATALINA_OPTS="-Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.SunLogger"

将此添加到 $CATALINA_HOME/conf/logging.properties

(可以使用 SEVERE、WARNING、INFO、CONFIG、FINE 设置处理程序的日志级别阈值, FINER、FINEST 或 ALL)

net.spy.memcached.level = WARNING

仅使 MemcachedConnection 更简洁:

net.spy.memcached.MemcachedConnection.level = WARNING

I know it's an old question and this solution will not work at runtime, but I had a similar problem and only found this question. You can find a way to set spymemcached logging level via tomcat config files here.

Important part:

A short summary how you can make spymemcached more silent:

Add the following to $CATALINA_HOME/bin/catalina.sh:

CATALINA_OPTS="-Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.SunLogger"

Add this to $CATALINA_HOME/conf/logging.properties:

(A handler's log level threshold can be set using SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL)

net.spy.memcached.level = WARNING

To make only the MemcachedConnection less verbose:

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