Allow custom error handling
Also added basic message logging with java.util.logging.Logger - not the
nicest framework, but its compatable with whatever final binding are
used.