spymemcached - is it possible to disable the logging system?

删除回忆录丶 提交于 2019-12-13 13:35:38

问题


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?


回答1:


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);



回答2:


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


来源:https://stackoverflow.com/questions/2610068/spymemcached-is-it-possible-to-disable-the-logging-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!