Support control of Raft debug logging

pull/1875/head
Philip O'Toole 2015-03-06 11:31:13 -08:00
parent bbd852e77d
commit fb618cb385
5 changed files with 11 additions and 0 deletions

View File

@ -98,6 +98,7 @@ type Config struct {
Logging struct {
File string `toml:"file"`
WriteTraceEnabled bool `toml:"write-tracing"`
RaftTraceEnabled bool `toml:"raft-tracing"`
} `toml:"logging"`
ContinuousQuery struct {

View File

@ -175,6 +175,7 @@ enabled = true
[logging]
file = "influxdb.log"
write-tracing = true
raft-tracing = true
# Configure the admin server
[admin]

View File

@ -53,6 +53,9 @@ func Run(config *Config, join, version string, logWriter *os.File) (*messaging.B
// Open broker, initialize or join as necessary.
b := openBroker(config.BrokerDir(), config.BrokerURL(), initBroker, joinURLs, logWriter)
// Configure debug of Raft module.
b.EnableRaftDebug(config.Logging.RaftTraceEnabled)
// Start the broker handler.
var h *Handler
if b != nil {

View File

@ -84,3 +84,4 @@ dir = "/tmp/influxdb/development/state"
[logging]
file = "/var/log/influxdb/influxd.log" # Leave blank to redirect logs to stderr.
write-tracing = false # If true, enables detailed logging of the write system.
raft-tracing = false # If true, enables detailed logging of Raft consensus.

View File

@ -75,6 +75,11 @@ func (b *Broker) SetLogOutput(w io.Writer) {
b.log.SetLogOutput(w)
}
// EnableRaftDebug controls debugging functionality in the Raft concensus module.
func (b *Broker) EnableRaftDebug(enable bool) {
b.log.DebugEnabled = enable
}
// Open initializes the log.
// The broker then must be initialized or join a cluster before it can be used.
func (b *Broker) Open(path string, u *url.URL) error {