Permalink
Browse files

fix some log messages

  • Loading branch information...
1 parent b973d3b commit 93d52ed78a39951c95e92f7ce65084f295b7c267 Roger Peppe committed Oct 11, 2012
View
@@ -68,7 +68,7 @@ func (s *store) info(curl *URL) (rev int, digest string, err error) {
return
}
for _, w := range info.Warnings {
- log.Printf("WARNING: charm store reports for %q: %s", key, w)
+ log.Printf("charm: WARNING: charm store reports for %q: %s", key, w)
}
if info.Errors != nil {
err = fmt.Errorf(
@@ -210,7 +210,7 @@ func (r *LocalRepository) Get(curl *URL) (Charm, error) {
}
chPath := filepath.Join(path, info.Name())
if ch, err := Read(chPath); err != nil {
- log.Printf("WARNING: failed to load charm at %q: %s", chPath, err)
+ log.Printf("charm: WARNING: failed to load charm at %q: %s", chPath, err)
} else if ch.Meta().Name == curl.Name {
if ch.Revision() == curl.Revision {
return ch, nil
View
@@ -132,7 +132,7 @@ func (s *StoreSuite) TestWarning(c *C) {
log.Target = c
defer func() { log.Target = orig }()
curl := charm.MustParseURL("cs:series/unwise")
- expect := `.* JUJU WARNING: charm store reports for "cs:series/unwise": foolishness` + "\n"
+ expect := `.* JUJU charm: WARNING: charm store reports for "cs:series/unwise": foolishness` + "\n"
r, err := s.store.Latest(curl)
c.Assert(r, Equals, 23)
c.Assert(err, IsNil)
@@ -312,9 +312,9 @@ func (s *LocalRepoSuite) TestLogsErrors(c *C) {
c.Assert(err, IsNil)
c.Assert(ch.Revision(), Equals, 1)
c.Assert(c.GetTestLog(), Matches, `
-.* JUJU WARNING: failed to load charm at ".*/series/blah": .*
-.* JUJU WARNING: failed to load charm at ".*/series/blah.charm": .*
-.* JUJU WARNING: failed to load charm at ".*/series/new": .*
+.* JUJU charm: WARNING: failed to load charm at ".*/series/blah": .*
+.* JUJU charm: WARNING: failed to load charm at ".*/series/blah.charm": .*
+.* JUJU charm: WARNING: failed to load charm at ".*/series/new": .*
`[1:])
}
View
@@ -53,7 +53,7 @@ func build() error {
return err
}
- log.Printf("Waiting for unit to reach %q status...", state.UnitStarted)
+ log.Printf("builddb: Waiting for unit to reach %q status...", state.UnitStarted)
unit := units[0]
last, info, err := unit.Status()
if err != nil {
@@ -78,15 +78,15 @@ func build() error {
if err != nil {
return err
}
- log.Printf("Built files published at http://%s", addr)
- log.Printf("Remember to destroy the environment when you're done...")
+ log.Printf("builddb: Built files published at http://%s", addr)
+ log.Printf("builddb: Remember to destroy the environment when you're done...")
return nil
}
func logStatus(status state.UnitStatus, info string) {
if info == "" {
- log.Printf("Unit status is %q", status)
+ log.Printf("builddb: Unit status is %q", status)
} else {
- log.Printf("Unit status is %q: %s", status, info)
+ log.Printf("builddb: Unit status is %q: %s", status, info)
}
}
View
@@ -110,7 +110,7 @@ func Main(c Command, ctx *Context, args []string) int {
}
if err := c.Run(ctx); err != nil {
if err != ErrSilent {
- log.Debugf("%s command failed: %s\n", c.Info().Name, err)
+ log.Printf("%s command failed: %s\n", c.Info().Name, err)
fmt.Fprintf(ctx.Stderr, "error: %v\n", err)
}
return 1
View
@@ -121,7 +121,7 @@ func (s *MainSuite) TestActualRunJujuArgsBeforeCommand(c *C) {
c.Assert(out, Equals, "error: "+msg+"\n")
content, err := ioutil.ReadFile(logpath)
c.Assert(err, IsNil)
- fullmsg := fmt.Sprintf(`(.|\n)*JUJU:DEBUG juju bootstrap command failed: %s\n`, msg)
+ fullmsg := fmt.Sprintf(`(.|\n)*JUJU juju bootstrap command failed: %s\n`, msg)
c.Assert(string(content), Matches, fullmsg)
}
@@ -134,7 +134,7 @@ func (s *MainSuite) TestActualRunJujuArgsAfterCommand(c *C) {
c.Assert(out, Equals, "error: "+msg+"\n")
content, err := ioutil.ReadFile(logpath)
c.Assert(err, IsNil)
- fullmsg := fmt.Sprintf(`(.|\n)*JUJU:DEBUG juju bootstrap command failed: %s\n`, msg)
+ fullmsg := fmt.Sprintf(`(.|\n)*JUJU juju bootstrap command failed: %s\n`, msg)
c.Assert(string(content), Matches, fullmsg)
}
View
@@ -88,12 +88,12 @@ func (c *SetCommand) Run(ctx *cmd.Context) error {
}
// 3. Update any keys that remain after validation and filtering.
if len(validated) > 0 {
- log.Debugf("updating configuration items: %v", validated)
+ log.Debugf("cmd/juju: updating configuration items: %v", validated)
cfg.Update(validated)
}
// 4. Delete any removed keys.
if len(remove) > 0 {
- log.Debugf("removing configuration items: %v", remove)
+ log.Debugf("cmd/juju: removing configuration items: %v", remove)
for _, k := range remove {
cfg.Delete(k)
}
View
@@ -67,13 +67,13 @@ func (c *SSHCommand) Run(ctx *cmd.Context) error {
func (c *SSHCommon) hostFromTarget(target string) (string, error) {
// is the target the id of a machine ?
if id, err := strconv.Atoi(target); err == nil {
- log.Printf("looking up address for machine %d...", id)
+ log.Printf("cmd/juju: looking up address for machine %d...", id)
// TODO(dfc) maybe we should have machine.PublicAddres() ?
return c.machinePublicAddress(id)
}
// maybe the target is a unit ?
if state.IsUnitName(target) {
- log.Printf("Looking up address for unit %q...", c.Target)
+ log.Printf("cmd/juju: Looking up address for unit %q...", c.Target)
unit, err := c.State.Unit(target)
if err != nil {
return "", err
View
@@ -139,7 +139,7 @@ waiting:
continue
}
if err := t.Wait(); err != nil {
- log.Printf("%s: %v", tasks[i], err)
+ log.Printf("cmd/jujud: %s: %v", tasks[i], err)
}
}
return chosen.err
View
@@ -60,7 +60,6 @@ func (c *BootstrapCommand) Run(_ *cmd.Context) error {
if err := m.SetInstanceId(c.InstanceId); err != nil {
return err
}
- log.Printf("bootstrap-state initial password %q", c.Conf.InitialPassword)
if c.Conf.InitialPassword != "" {
if err := m.SetPassword(c.Conf.InitialPassword); err != nil {
return err
View
@@ -50,10 +50,10 @@ func (a *MachineAgent) Stop() error {
// Run runs a machine agent.
func (a *MachineAgent) Run(_ *cmd.Context) error {
- defer log.Printf("machiner: machine agent exiting")
+ defer log.Printf("cmd/jujud: machine agent exiting")
defer a.tomb.Done()
for a.tomb.Err() == tomb.ErrStillAlive {
- log.Printf("machiner: machine agent starting")
+ log.Printf("cmd/jujud: machine agent starting")
err := a.runOnce()
if ug, ok := err.(*UpgradeReadyError); ok {
if err = ug.ChangeAgentTools(); err == nil {
@@ -62,19 +62,19 @@ func (a *MachineAgent) Run(_ *cmd.Context) error {
}
}
if err == worker.ErrDead {
- log.Printf("machiner: machine is dead")
+ log.Printf("cmd/jujud: machine is dead")
return nil
}
if err == nil {
- log.Printf("machiner: workers died with no error")
+ log.Printf("cmd/jujud: workers died with no error")
} else {
- log.Printf("machiner: %v", err)
+ log.Printf("cmd/jujud: %v", err)
}
select {
case <-a.tomb.Dying():
a.tomb.Kill(err)
case <-time.After(retryDelay):
- log.Printf("machiner: rerunning machiner")
+ log.Printf("cmd/jujud: rerunning machiner")
}
}
return a.tomb.Err()
@@ -93,7 +93,7 @@ func (a *MachineAgent) runOnce() error {
if err != nil {
return err
}
- log.Printf("machiner: requested workers for machine agent: ", m.Workers())
+ log.Printf("cmd/jujud: requested workers for machine agent: ", m.Workers())
tasks := []task{NewUpgrader(st, m, a.Conf.DataDir)}
for _, w := range m.Workers() {
var t task
@@ -106,7 +106,7 @@ func (a *MachineAgent) runOnce() error {
t = firewaller.NewFirewaller(st)
}
if t == nil {
- log.Printf("machiner: ignoring unknown worker %q", w)
+ log.Printf("cmd/jujud: ignoring unknown worker %q", w)
continue
}
tasks = append(tasks, t)
View
@@ -48,7 +48,7 @@ func (a *UnitAgent) Stop() error {
// Run runs a unit agent.
func (a *UnitAgent) Run(ctx *cmd.Context) error {
- defer log.Printf("uniter: unit agent exiting")
+ defer log.Printf("cmd/jujud: unit agent exiting")
defer a.tomb.Done()
for a.tomb.Err() == tomb.ErrStillAlive {
err := a.runOnce()
@@ -59,19 +59,19 @@ func (a *UnitAgent) Run(ctx *cmd.Context) error {
}
}
if err == worker.ErrDead {
- log.Printf("uniter: unit is dead")
+ log.Printf("cmd/jujud: unit is dead")
return nil
}
if err == nil {
- log.Printf("uniter: workers died with no error")
+ log.Printf("cmd/jujud: workers died with no error")
} else {
- log.Printf("uniter: %v", err)
+ log.Printf("cmd/jujud: %v", err)
}
select {
case <-a.tomb.Dying():
a.tomb.Kill(err)
case <-time.After(retryDelay):
- log.Printf("uniter: rerunning uniter")
+ log.Printf("cmd/jujud: rerunning uniter")
}
}
return a.tomb.Err()
View
@@ -46,7 +46,7 @@ func (e *UpgradeReadyError) ChangeAgentTools() error {
if err != nil {
return err
}
- log.Printf("upgrader: upgraded from %v to %v (%q)", e.OldTools.Binary, tools.Binary, tools.URL)
+ log.Printf("cmd/jujud: upgrader upgraded from %v to %v (%q)", e.OldTools.Binary, tools.Binary, tools.URL)
return nil
}
@@ -92,7 +92,7 @@ func (u *Upgrader) run() error {
// Don't abort everything because we can't find the tools directory.
// The problem should sort itself out as we will immediately
// download some more tools and upgrade.
- log.Printf("upgrader: cannot read current tools: %v", err)
+ log.Printf("cmd/jujud: upgrader cannot read current tools: %v", err)
currentTools = &state.Tools{
Binary: version.Current,
}
@@ -143,13 +143,13 @@ func (u *Upgrader) run() error {
if environ == nil {
environ, err = environs.New(cfg)
if err != nil {
- log.Printf("upgrader: loaded invalid initial environment configuration: %v", err)
+ log.Printf("cmd/jujud: upgrader loaded invalid initial environment configuration: %v", err)
break
}
} else {
err = environ.SetConfig(cfg)
if err != nil {
- log.Printf("upgrader: loaded invalid environment configuration: %v", err)
+ log.Printf("cmd/jujud: upgrader loaded invalid environment configuration: %v", err)
// continue on, because the version number is still significant.
}
}
@@ -183,39 +183,39 @@ func (u *Upgrader) run() error {
}
tools, err := environs.FindTools(environ, binary, flags)
if err != nil {
- log.Printf("upgrader: error finding tools for %v: %v", binary, err)
+ log.Printf("cmd/jujud: upgrader error finding tools for %v: %v", binary, err)
noDelay()
// TODO(rog): poll until tools become available.
break
}
if tools.Binary != binary {
if tools.Number == version.Current.Number {
// TODO(rog): poll until tools become available.
- log.Printf("upgrader: version %v requested but found only current version: %v", binary, tools.Number)
+ log.Printf("cmd/jujud: upgrader: version %v requested but found only current version: %v", binary, tools.Number)
noDelay()
break
}
- log.Printf("upgrader: cannot find exact tools match for %s; using %s instead", binary, tools.Binary)
+ log.Printf("cmd/jujud: upgrader cannot find exact tools match for %s; using %s instead", binary, tools.Binary)
}
- log.Printf("upgrader: downloading %q", tools.URL)
+ log.Printf("cmd/jujud: upgrader downloading %q", tools.URL)
download = downloader.New(tools.URL, "")
downloadTools = tools
downloadDone = download.Done()
case status := <-downloadDone:
tools := downloadTools
download, downloadTools, downloadDone = nil, nil, nil
if status.Err != nil {
- log.Printf("upgrader: download of %v failed: %v", tools.Binary, status.Err)
+ log.Printf("cmd/jujud: upgrader download of %v failed: %v", tools.Binary, status.Err)
noDelay()
break
}
err := environs.UnpackTools(u.dataDir, tools, status.File)
status.File.Close()
if err := os.Remove(status.File.Name()); err != nil {
- log.Printf("upgrader: cannot remove temporary download file: %v", err)
+ log.Printf("cmd/jujud: upgrader cannot remove temporary download file: %v", err)
}
if err != nil {
- log.Printf("upgrader: cannot unpack %v tools: %v", tools.Binary, err)
+ log.Printf("cmd/jujud: upgrader cannot unpack %v tools: %v", tools.Binary, err)
noDelay()
break
}
View
@@ -90,7 +90,7 @@ func (s *SuperCommandSuite) TestLogging(c *C) {
ctx := dummyContext(c)
code := cmd.Main(jc, ctx, []string{"blah", "--option", "error", "--debug"})
c.Assert(code, Equals, 1)
- c.Assert(bufferString(ctx.Stderr), Matches, `.* JUJU:DEBUG jujutest blah command failed: BAM!
+ c.Assert(bufferString(ctx.Stderr), Matches, `.* JUJU jujutest blah command failed: BAM!
error: BAM!
`)
}
View
@@ -158,7 +158,7 @@ func init() {
// operation listener. All opened environments after Reset will share
// the same underlying state.
func Reset() {
- log.Printf("dummy: reset environment")
+ log.Printf("environs/dummy: reset environment")
p := &providerInstance
p.mu.Lock()
defer p.mu.Unlock()
@@ -194,7 +194,7 @@ func newState(name string, ops chan<- Operation, fwmode config.FirewallMode) *en
// that looks like a tools archive so Bootstrap can
// find some tools and initialise the state correctly.
func putFakeTools(s environs.StorageWriter) {
- log.Printf("putting fake tools")
+ log.Printf("environs/dummy: putting fake tools")
path := environs.ToolsStoragePath(version.Current)
toolsContents := "tools archive, honest guv"
err := s.Put(path, strings.NewReader(toolsContents), int64(len(toolsContents)))
@@ -470,7 +470,7 @@ func (e *environ) Destroy([]environs.Instance) error {
func (e *environ) StartInstance(machineId int, info *state.Info, tools *state.Tools) (environs.Instance, error) {
defer delay()
- log.Printf("dummy startinstance, machine %d", machineId)
+ log.Printf("environs/dummy: dummy startinstance, machine %d", machineId)
if err := e.checkBroken("StartInstance"); err != nil {
return nil, err
}
@@ -582,7 +582,7 @@ func (inst *instance) WaitDNSName() (string, error) {
func (inst *instance) OpenPorts(machineId int, ports []state.Port) error {
defer delay()
- log.Printf("openPorts %d, %#v", machineId, ports)
+ log.Printf("environs/dummy: openPorts %d, %#v", machineId, ports)
if inst.machineId != machineId {
panic(fmt.Errorf("OpenPorts with mismatched machine id, expected %d got %d", inst.machineId, machineId))
}
@@ -657,7 +657,7 @@ var providerDelay time.Duration
// pause execution to simulate the latency of a real provider
func delay() {
if providerDelay > 0 {
- log.Printf("dummy: pausing for %v", providerDelay)
+ log.Printf("environs/dummy: pausing for %v", providerDelay)
<-time.After(providerDelay)
}
}
View
@@ -348,7 +348,7 @@ func (e *environ) startInstance(machineId int, info *state.Info, tools *state.To
if err != nil {
return nil, fmt.Errorf("cannot make user data: %v", err)
}
- log.Debugf("ec2 user data: %q", userData)
+ log.Debugf("environs/ec2: ec2 user data: %q", userData)
groups, err := e.setUpGroups(machineId)
if err != nil {
return nil, fmt.Errorf("cannot set up groups: %v", err)
Oops, something went wrong.

0 comments on commit 93d52ed

Please sign in to comment.