INFO net.spy.memcached.MemcachedConnection: Reconnecting {QA sa=,}


I kept getting this annoying message every 30 seconds (dont intend to offend anyone here :))

2012-02-09 13:55:59.322 INFO net.spy.memcached.MemcachedConnection:  Reconnecting {QA sa=, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
2012-02-09 13:55:59.323 INFO net.spy.memcached.MemcachedConnection:  Connection state changed for
2012-02-09 13:55:59.323 INFO net.spy.memcached.MemcachedConnection:  Reconnecting due to failure to connect to {QA sa=, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} Connection refused
	at Method)
	at net.spy.memcached.MemcachedConnection.handleIO(
	at net.spy.memcached.MemcachedConnection.handleIO(
2012-02-09 13:55:59.324 WARN net.spy.memcached.MemcachedConnection:  Closing, and reopening {QA sa=, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}, attempt 26.

This is what I had running on my setup. All on the localhost

prompt$ /usr/bin/memcached -m 64 -U 11211 -p 11211 -l
ps -ef | grep memcached shows
username  12029  2961  0 13:32 pts/2    00:00:00 /usr/bin/memcached -m 64 -U 11211 -p 11211 -l
sudo netstat -anp | grep 11211 shows
prompt$ sudo netstat -anp | grep 11211
tcp        0      0*               LISTEN      12029/memcached 
tcp        0      0         ESTABLISHED 12029/memcached 
tcp6       0      0         ESTABLISHED 13941/java      
udp        0      0*                           12029/memcached 
unix  2      [ ACC ]     STREAM     LISTENING     11211    1821/dbus-daemon    @/tmp/dbus-TelpJZAoJl


private MyClass() throws UnknownHostException, IOException {
	super(new InetSocketAddress("", 11211));

I am able to set/get with no issues at all. My cache populates and work perfectly well. Just that warning/info message on log4j.

To fix this, I loaded the memcaced without “-l”

prompt>$ /usr/bin/memcached -m 64 -U 11211 -p 11211

My memcached still works well, without that message.

Include Log4j to my java project in eclipse


Well, like any programmer, I started with System.out.println’s for my logging and debugging needs. But only after I wrote myself a set of test cases. As you assumed right I ran out of thought process to organize my log’s very soon. As I was debugging stuff, I realized that my logs not only need to be categorized they need to be “intended”. When I “intended” I meant that sometime in future I want to be able to say something like “show me logs of all threading happening on my server”. So I know who is using my threads, when and is some client eating up my threadpool ? I also want to be able to drive down to the client level to figure out who exactly is eating it up.

The that is “important” for me, not urgent as yet. As any good time management advice will tell you, to focus on your urgent and important. So currently I need to be able to just organize my logs into the regular 4 levels, fatal, error, info and debug. So here goes. I choose Log4j for many reasons
– Tried and tested
– A lot of help on the net for log4j
– Best Practices are already identified, documented and followed (
* Logger Design
* Should be greppable
* Separate files for separate areas of interest
* Device/Connection/StreamManager threads
* Stream Management
* Request Issues
* Database Issues
* Memcached Issues
* TimeStamps with timezones from server and client and down to nanoseconds (yyyy-MM-dd/HH:mm:ss.SSS/zzz) Java does not support nanoseconds
* Identity (who tried to do what)
* Single Line (no multiple line’s. Except, exceptions
* When did user last login ?
* Error reported to user “must” be logged (exact Error)
* Every Class to have
* public static final Logger log = Logger.getLogger(MyClass.class) ;

I did encounter some trouble starting up. So this blog will help those who want to startup too. The the above advice, I also did the following
– In my main method I did
– Added under the same level as src directory on my eclipse project
– My contents are
log4j.rootLogger=DEBUG, CA
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x – %m%n


#Attribute is one of the following:
#0 -> Reset All Attributes (return to normal mode)
#1 -> Bright (Usually turns on BOLD)
#2 -> Dim
#3 -> Underline
#5 -> link
#7 -> Reverse
#8 -> Hidden
#Foreground is one of the following:
#30 -> Black
#31 -> Red
#32 -> Green
#33 -> Yellow
#34 -> Blue
#35 -> Magenta
#36 -> Cyan
#37 -> White
#Background is one of the following:
#40 -> Black
#41 -> Red
#42 -> Green
#43 -> Yellow
#44 -> Blue
#45 -> Magenta
#46 -> Cyan
#47 -> White;31;35;36;32;34

I am still trying to get colors in my log, but that does not work. When I get it up and running, I’ll edit this post with more. If you have a solution on this, please comment.