Added log4j logging possibility and fixed logging