Console exception logging middleware