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.
Merge pull request #5097 from minrk/logging-some-more

minor notebook logging changes