title: How to log http server errors in golang?
body: <p>I'm trying to catch and log http error 400 that happens when url params are not encoded properly. </p>
  
  <p>My server implementation looks like:</p>
  
  <pre><code>router := http.NewServeMux()
  router.HandleFunc("/", requestHandler)
  
  s := &amp;http.Server{
      Addr:           ":8080",
      Handler:        router,
      ErrorLog:       myLogger,
  }
  log.Fatal(s.ListenAndServe())
  </code></pre>
  
  <p>The request never reaches <code>requestHandler</code>, and having <code>ErrorLog: myLogger</code> makes no difference.</p>