Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spymemcached - is it possible to disable the logging system?

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?

like image 998
Kico Lobo Avatar asked Dec 17 '22 01:12

Kico Lobo


2 Answers

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);
like image 58
Edd Avatar answered Dec 21 '22 09:12

Edd


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
like image 27
teano Avatar answered Dec 21 '22 10:12

teano