Introduce some default log verbosity control
Move a lot of common error logging into better buckets: glog.Errorf() - Always an error glog.Warningf() - Something unexpected, but probably not an error glog.V(0) - Generally useful for this to ALWAYS be visible to an operator * Programmer errors * Logging extra info about a panic * CLI argument handling glog.V(1) - A reasonable default log level if you don't want verbosity * Information about config (listening on X, watching Y) * Errors that repeat frequently that relate to conditions that can be corrected (pod detected as unhealthy) glog.V(2) - Useful steady state information about the service * Logging HTTP requests and their exit code * System state changing (killing pod) * Controller state change events (starting pods) * Scheduler log messages glog.V(3) - Extended information about changes * More info about system state changes glog.V(4) - Debug level verbosity (for now) * Logging in particularly thorny parts of code where you may want to come back later and check it
This commit is contained in:
@@ -115,7 +115,7 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *uint64) {
|
||||
// that called us call us again.
|
||||
return
|
||||
}
|
||||
glog.Infof("Got watch: %#v", event)
|
||||
glog.V(4).Infof("Got watch: %#v", event)
|
||||
rc, ok := event.Object.(*api.ReplicationController)
|
||||
if !ok {
|
||||
glog.Errorf("unexpected object: %#v", event.Object)
|
||||
@@ -125,7 +125,7 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *uint64) {
|
||||
*resourceVersion = rc.ResourceVersion + 1
|
||||
// Sync even if this is a deletion event, to ensure that we leave
|
||||
// it in the desired state.
|
||||
glog.Infof("About to sync from watch: %v", rc.ID)
|
||||
glog.V(4).Infof("About to sync from watch: %v", rc.ID)
|
||||
rm.syncHandler(*rc)
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ func (rm *ReplicationManager) syncReplicationController(controllerSpec api.Repli
|
||||
diff *= -1
|
||||
wait := sync.WaitGroup{}
|
||||
wait.Add(diff)
|
||||
glog.Infof("Too few replicas, creating %d\n", diff)
|
||||
glog.V(2).Infof("Too few replicas, creating %d\n", diff)
|
||||
for i := 0; i < diff; i++ {
|
||||
go func() {
|
||||
defer wait.Done()
|
||||
@@ -162,7 +162,7 @@ func (rm *ReplicationManager) syncReplicationController(controllerSpec api.Repli
|
||||
}
|
||||
wait.Wait()
|
||||
} else if diff > 0 {
|
||||
glog.Infof("Too many replicas, deleting %d\n", diff)
|
||||
glog.V(2).Infof("Too many replicas, deleting %d\n", diff)
|
||||
wait := sync.WaitGroup{}
|
||||
wait.Add(diff)
|
||||
for i := 0; i < diff; i++ {
|
||||
@@ -191,7 +191,7 @@ func (rm *ReplicationManager) synchronize() {
|
||||
for ix := range controllerSpecs {
|
||||
go func(ix int) {
|
||||
defer wg.Done()
|
||||
glog.Infof("periodic sync of %v", controllerSpecs[ix].ID)
|
||||
glog.V(4).Infof("periodic sync of %v", controllerSpecs[ix].ID)
|
||||
err := rm.syncHandler(controllerSpecs[ix])
|
||||
if err != nil {
|
||||
glog.Errorf("Error synchronizing: %#v", err)
|
||||
|
Reference in New Issue
Block a user