Issue #15187 has been updated by Josh Partlow.

Status changed from Closed to Re-opened
Target version changed from 3.2.0 to 3.3.0
Branch deleted (https://github.com/puppetlabs/puppet/pull/900)

The original pull request (https://github.com/puppetlabs/puppet/pull/900) will 
be reverted in 3.2.2 because of #20900 and #20919.

There have been significant changes in logging and daemonizing betwen 2.7.x and 
3.x when this was first opened, as well.

And there are behavior issues with regards to how existing users expect logging 
to behave.

The point of this ticket is to make puppet agent failures more obvious to the 
end user.

Luke's example is the case of:

 'puppet agent --server master.not.online'

when no agent is running.  In the current 3.1.1 behavior (and soon to be in 
3.2.2 after the patch applied in 3.2.1 is reverted) this fails silently and 
returns you to a prompt, logging the Connection Refused errors to syslog.  This 
is because we daemonize by default and set syslog as the default log 
destination (on POSIX with syslog).

Running with the --onetime flag does not change this.

Running with the --no-daemonize flag leaves the agent attached to the current 
console, but still logs only to syslog.

There are users who expect that there is no console output unless otherwise 
specified.  In particular cron jobs of 'puppet agent --onetime' are expected by 
some users to produce no stdout/stderr output (because this is how Puppet has 
behaved to date).  (See #20900 and #20919)

---

The patch originally associated with this ticket ensured that the agent always 
added a console logger.  In the case of daemonizing agents, though, this is 
only present until Puppet::Daemon closes it after the agent is daemonized, 
which occurs early in the setup code.  So errors such as Connection Refused, 
would never make it to the console.

If there are examples of common fatal errors which occur prior to 
daemonization, it might be worthwhile to revisit this.

But given that the current defaults are for a daemonized puppet agent which 
logs to syslog, and that users working with cron expect this behavior, I don't 
think there is much to do here.

If we specifically want to change default behavior, we could default to both 
syslog and console unless a --logdest is set.  This would provide momentary 
console logging prior to daemonization and console logging for no-daemonize 
agents by default.  It would force --no-daemonize cron users to set a --logdest 
to avoid console output for occasional notice+ log output and would thus be a 
minor? behavorial change from 3.1.1.  (One of the issues with the current patch 
was that it accidentally set log_level to info at the same time).

It would not address the original issue in this ticket of a `puppet agent 
--server master.not.online` failing silently.

The combination of logdest, defaults and verbose and debug on whether or not a 
console log is set is somewhat confusing for this proposed patch (see the 
--logdest description in the patch).  Or maybe my wording is just bad.

If we want to go this route, small new patch is here: 
https://github.com/jpartlow/puppet/tree/ticket/master/15187-alt-agent-logging-to-console-unless-logdest

Personally, I'm -1 on this, because of behavior changes for what seems small 
gain, which is why I haven't submitted it as a pull request.

----------------------------------------
Bug #15187: Some errors do not show unless in debug mode
https://projects.puppetlabs.com/issues/15187#change-91830

* Author: Luke Kanies
* Status: Re-opened
* Priority: Normal
* Assignee: eric sorenson
* Category: logging
* Target version: 3.3.0
* Affected Puppet version: 3.0.0
* Keywords: 
* Branch: 
----------------------------------------
I am not running the actual server, so the error should be 'cannot connect' or 
something.

Here is the output with no debug:

    luke@shiruken $ puppet agent  -- sever localhost
    ^Cluke@shiruken $

Note that it produces no output and never returns (look for another ticket on 
that).

Here is the (abridged) output with debug:


    Error: Could not send report: Connection refused - connect(2)
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:560
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:560
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:560
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:67
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:101
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:560
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:553
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:542
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1035
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:857
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:103
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:103
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:85
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:177
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:188
    /Users/luke/git/puppet/lib/puppet/indirector/request.rb:216
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:188
    /Users/luke/git/puppet/lib/puppet/indirector/rest.rb:176
    /Users/luke/git/puppet/lib/puppet/indirector/indirection.rb:271
    /Users/luke/git/puppet/lib/puppet/configurer.rb:195
    /Users/luke/git/puppet/lib/puppet/configurer.rb:189
    /Users/luke/git/puppet/lib/puppet/agent.rb:44
    /Users/luke/git/puppet/lib/puppet/agent/locker.rb:22
    /Users/luke/git/puppet/lib/puppet/agent.rb:44
    
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/sync.rb:230
    /Users/luke/git/puppet/lib/puppet/agent.rb:44
    /Users/luke/git/puppet/lib/puppet/agent.rb:118
    /Users/luke/git/puppet/lib/puppet/agent.rb:42
    /Users/luke/git/puppet/lib/puppet/agent.rb:83
    /Users/luke/git/puppet/lib/puppet/agent.rb:41
    /Users/luke/git/puppet/lib/puppet/application.rb:175
    /Users/luke/git/puppet/lib/puppet/application.rb:175
    /Users/luke/git/puppet/lib/puppet/agent.rb:39
    /Users/luke/git/puppet/lib/puppet/daemon.rb:205
    /Users/luke/git/puppet/lib/puppet/daemon.rb:167
    /Users/luke/git/puppet/lib/puppet/daemon.rb:167
    /Users/luke/git/puppet/lib/puppet/daemon.rb:145
    /Users/luke/git/puppet/lib/puppet/application/agent.rb:354
    /Users/luke/git/puppet/lib/puppet/application/agent.rb:309
    /Users/luke/git/puppet/lib/puppet/application.rb:342
    /Users/luke/git/puppet/lib/puppet/application.rb:436
    /Users/luke/git/puppet/lib/puppet/application.rb:342
    /Users/luke/git/puppet/lib/puppet/util.rb:529
    /Users/luke/git/puppet/lib/puppet/application.rb:342
    /Users/luke/git/puppet/lib/puppet/util/command_line.rb:74
    /Users/luke/git/puppet/bin/puppet:10
    
Still not a fatal error, but at least you get the output.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to