Merge lp:~thumper/juju-core/logger-initial-state into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Tim Penhey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1826 |
Proposed branch: | lp:~thumper/juju-core/logger-initial-state |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
165 lines (+20/-19) 5 files modified
cmd/jujud/machine.go (+6/-0) environs/cloudinit/cloudinit.go (+5/-11) environs/cloudinit/cloudinit_test.go (+4/-4) provider/local/environ.go (+1/-2) upstart/service.go (+4/-2) |
To merge this branch: | bzr merge lp:~thumper/juju-core/logger-initial-state |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+185962@code.launchpad.net |
Commit message
A little clean up for initial agent logging.
Now that we have a logging worker that will set the log
levels to the system wide setting when it starts, we can
start all new agents with debug, and then as soon as the
agent starts, it will change it.
A drive by fix here to have the machine agent explicitly
remove the logfile writer from loggo if one has been set.
Machine agent upstart jobs that are around from before 1.16
will otherwise cause duplicate lines.
Description of the change
A little clean up for initial agent logging.
Now that we have a logging worker that will set the log
levels to the system wide setting when it starts, we can
start all new agents with debug, and then as soon as the
agent starts, it will change it.
A drive by fix here to have the machine agent explicitly
remove the logfile writer from loggo if one has been set.
Machine agent upstart jobs that are around from before 1.16
will otherwise cause duplicate lines.
Reviewers: mp+185962_ code.launchpad. net,
Message:
Please take a look.
Description:
A little clean up for initial agent logging.
Now that we have a logging worker that will set the log
levels to the system wide setting when it starts, we can
start all new agents with debug, and then as soon as the
agent starts, it will change it.
A drive by fix here to have the machine agent explicitly
remove the logfile writer from loggo if one has been set.
Machine agent upstart jobs that are around from before 1.16
will otherwise cause duplicate lines.
https:/ /code.launchpad .net/~thumper/ juju-core/ logger- initial- state/+ merge/185962
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/13717044/
Affected files (+22, -19 lines): machine. go cloudinit/ cloudinit. go cloudinit/ cloudinit_ test.go local/environ. go
A [revision details]
M cmd/jujud/
M environs/
M environs/
M provider/
M upstart/service.go
Index: [revision details] 20130916220230- s30jbjsc5zvfzii 7
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: upstart/service.go service. go'
=== modified file 'upstart/
--- upstart/service.go 2013-09-13 05:20:56 +0000
+++ upstart/service.go 2013-09-16 22:02:24 +0000
@@ -42,9 +42,11 @@
// MachineAgentUps tartService returns the upstart config for a machine tartService( name, toolsDir, dataDir, logDir, tag, tartService( name, toolsDir, dataDir, logDir, tag, Join(logDir, tag+".log") dataDir) +
agent
// based on the tag and machineId passed in.
-func MachineAgentUps
machineId, logConfig string, env map[string]string) *Conf {
+func MachineAgentUps
machineId string, env map[string]string) *Conf {
svc := NewService(name)
logFile := filepath.
+ // The machine agent always starts with debug turned on. The logger
worker
+ // will update this to the system logging environment as soon as it
starts.
return &Conf{
Service: *svc,
Desc: fmt.Sprintf("juju %s agent", tag),
@@ -55,7 +57,7 @@
" machine" +
" --data-dir " + utils.ShQuote(
" --machine-id " + machineId +
- " " + logConfig,
+ " --debug",
Out: logFile,
Env: env,
}
Index: cmd/jujud/ machine. go machine. go' machine. go 2013-09-12 22:18:10 +0000 machine. go 2013-09-17 01:58:35 +0000
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -10,6 +10,7 @@
"time"
"launchpad. net/gnuflag" net/loggo" net/tomb"
+ "launchpad.
"launchpad.
"launchpad. net/juju- core/agent"
@@ -97,6 +98,11 @@
// Run runs a machine agent. ter("logfile" ) Infof(" machine agent %v start", a.Tag()) read(a. Tag()); err != nil {
func (a *MachineAgent) Run(_ *cmd.Context) error {
+ // Due to changes in the logging, and needing to care about old
+ // environments that have been upgraded, we need to explicitly remove the
+ // file writer if one has been added, otherwise we will get duplicate
+ // lines of all logging in the log file.
+ loggo.RemoveWri
defer a.tomb.Done()
log.
if err := a.Conf.
Index: environs/ cloudinit/ cl...