Save http trace to a file (#5300)

Save http trace to a file instead of displaying it onto the console.
the environment variable MINIO_HTTP_TRACE will be a filepath instead
of a boolean.

This to handle the scenario where both json and http tracing are
turned on. In that case, both http trace and json output are displayed
on the screen making the json not parsable. Loging this trace onto
a file helps us avoid that scenario.

Fixes #5263
This commit is contained in:
kannappanr
2018-01-05 11:24:31 -08:00
committed by GitHub
parent de2ce5acb4
commit 1de3bd6911
6 changed files with 38 additions and 8 deletions

View File

@@ -61,6 +61,7 @@ func handleSignals() {
exit(err == nil && oerr == nil)
case osSignal := <-globalOSSignalCh:
stopHTTPTrace()
log.Printf("Exiting on signal %v\n", osSignal)
exit(stopProcess())
case signal := <-globalServiceSignalCh:
@@ -71,12 +72,14 @@ func handleSignals() {
log.Println("Restarting on service signal")
err := globalHTTPServer.Shutdown()
errorIf(err, "Unable to shutdown http server")
stopHTTPTrace()
rerr := restartProcess()
errorIf(rerr, "Unable to restart the server")
exit(err == nil && rerr == nil)
case serviceStop:
log.Println("Stopping on service signal")
stopHTTPTrace()
exit(stopProcess())
}
}