minor notebook logging changes

log refer only on 4XX, and never log user agent

This function was ported from nbviewer, and some of the choices were not quite right for the notebook server.