improves error handling and adds Log4J
fixes log4j conf bug