Added log4j support in dispatcher.
Fixed the conditional so that it doesn't run a full mapping in every case.