logdest and level in puppet agent

295 views
Skip to first unread message

donavan

unread,
Feb 20, 2011, 3:44:03 AM2/20/11
to Puppet Developers
Is there a specific reason for forcing the log destination to :console
in the agent application? If the log level is set with verbose/debug
then :console is always added to any logdest the user specifies. I see
bits of this in the application tests and patches for #1886 & #5952.

The apply and master applications, for example, don't behave this way.
The user is able to set the log level with verbose/debug options
independently of the logdest. This leads to inconsistent behavior
across applications when trying to use an alternate destination[1].

Ideally I'd like to set log level to any of the supported levels,
independent of destination. I could also see the argument for 'format'
of color/html/json/text being split out of logdest as well.

[1] https://gist.github.com/83555

Luke Kanies

unread,
Feb 20, 2011, 4:57:32 PM2/20/11
to puppe...@googlegroups.com

Hmm, that's probably a bug. I know the behavior has changed a bit over the years, but I didn't think either of those modes still required console access. Is that true even when the agent goes into the background? Or do you want a foreground process with no console logging?


--
Experience is the name everyone gives to their mistakes.
-- Oscar Wilde
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199


Markus Roberts

unread,
Feb 20, 2011, 7:51:24 PM2/20/11
to puppe...@googlegroups.com
On Sun, Feb 20, 2011 at 12:44 AM, donavan <don...@desinc.net> wrote:
Is there a specific reason for forcing the log destination to :console
in the agent application? If the log level is set with verbose/debug
then :console is always added to any logdest the user specifies. I see
bits of this in the application tests and patches for #1886 & #5952.

It looks like this behaviour was copied from puppetqd (now queue), where it may also be a bug when they were moved to the application controller paradigm in commit 156fb81ca914f6d697dc2cb81788a1d9ab5a23e4; I'd say that Luke's right, it's a copy-paste bug.

-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the 
maritime general prudential rule
------------------------------------------------------------

donavan

unread,
Feb 22, 2011, 2:11:49 AM2/22/11
to Puppet Developers
On Feb 20, 1:57 pm, Luke Kanies <l...@puppetlabs.com> wrote:
> Hmm, that's probably a bug.  I know the behavior has changed a bit over the years, but I didn't think either of those modes still required console access.  Is that true even when the agent goes into the background?  Or do you want a foreground process with no console logging?

Yes, I think puppet agent would still open a
Puppet::Util::Log.newdestination(:console) if verbose or debug is set,
regardless of --daemonize.

My particular use case is a foreground process without
Puppet::Util::Log.newdestination(:console) set. My snippet provided
Puppet::Util::Log.newdestination(:json) to output each message in json
format instead of plain/structured text. That way other programs using
%x{puppet agent} would have simple to parse messages. Works great with
most puppet applications. In agent two copies of each message are
written to STDOUT, one from :console and one from :json.
I could also see a use case for something like the syslog/file/host/
report destinations from a cronjob. In any of those cases you can't
get info or higher messages without getting output to STDOUT as well.
Reply all
Reply to author
Forward
0 new messages