Added log to middleware