Add script to generate logs for log4j & socket  + Fix bug close server listening on port

Add script to generate logs for log4j & socket  + Fix bug close server listening on port