Error handling and log4j setup.