Allow control of HTTP logging

pull/2330/head
Philip O'Toole 2015-04-11 12:20:39 -07:00 committed by Philip O'Toole
parent e890468b48
commit a3fbba33da
4 changed files with 10 additions and 4 deletions

View File

@ -179,6 +179,7 @@ type Config struct {
Snapshot Snapshot `toml:"snapshot"`
Logging struct {
HTTPAccess bool `toml:"http-access"`
WriteTracing bool `toml:"write-tracing"`
RaftTracing bool `toml:"raft-tracing"`
} `toml:"logging"`
@ -238,6 +239,10 @@ func NewConfig() *Config {
c.Data.RetentionCheckPeriod = Duration(DefaultRetentionCheckPeriod)
c.Data.RetentionCreatePeriod = Duration(DefaultRetentionCreatePeriod)
c.Logging.HTTPAccess = true
c.Logging.WriteTracing = false
c.Logging.RaftTracing = false
c.Monitoring.Enabled = false
c.Monitoring.WriteInterval = Duration(DefaultStatisticsWriteInterval)
c.ContinuousQuery.RecomputePreviousN = DefaultContinuousQueryRecomputePreviousN

View File

@ -104,6 +104,7 @@ func (h *Handler) serveData(w http.ResponseWriter, r *http.Request) {
sh := httpd.NewClusterHandler(h.Server, h.Config.Authentication.Enabled,
h.Config.Snapshot.Enabled, version)
sh.WriteTrace = h.Config.Logging.WriteTracing
sh.HTTPAccessLogging = h.Config.Logging.HTTPAccess
sh.ServeHTTP(w, r)
return
}

View File

@ -1426,7 +1426,6 @@ func Test3NodeServerFailover(t *testing.T) {
// ensure that all queries work if there are more nodes in a cluster than the replication factor
func Test3NodeClusterPartiallyReplicated(t *testing.T) {
t.Skip("Skipping due to instability")
testName := "3-node server integration partial replication"
if testing.Short() {
t.Skip(fmt.Sprintf("skipping '%s'", testName))

View File

@ -53,8 +53,9 @@ type Handler struct {
snapshotEnabled bool
version string
Logger *log.Logger
WriteTrace bool // Detailed logging of write path
Logger *log.Logger
HTTPAccessLogging bool // Log every HTTP access.
WriteTrace bool // Detailed logging of write path
}
// NewClusterHandler is the http handler for cluster communication endpoints
@ -169,7 +170,7 @@ func (h *Handler) SetRoutes(routes []route) {
handler = versionHeader(handler, h.version)
handler = cors(handler)
handler = requestID(handler)
if r.log {
if h.HTTPAccessLogging && r.log {
handler = logging(handler, r.name, h.Logger)
}
handler = recovery(handler, r.name, h.Logger) // make sure recovery is always last