spymemcached - is it possible to disable the logging system?
Asked Answered
V

2

5

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?

Voyeur answered 9/4, 2010 at 18:55 Comment(0)
C
9

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);
Curfew answered 5/3, 2011 at 1:22 Comment(2)
hi should I add these lines before the lines for creating the memcached client or where should I put them? is there any way I can completely disable logging using the web.xml in glassfish 4.0 please assist.Hebetic
If you want it completely disabled, you can set the logging level to Level.OFF before creating the MemcachedClient object.Domicile
D
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
Duprey answered 10/2, 2016 at 12:31 Comment(1)
put this in setenv.sh: L4J_OPTS="-Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.Log4JLogger" JVM_OPTS="" CATALINA_OPTS="${JVM_OPTS} ${L4J_OPTS}" Colourable

© 2022 - 2024 — McMap. All rights reserved.