Fixed log4j duplicated logs. Added some debug logs.