[Catalyst] Selective debug output

2007-11-06 Thread Joe Landman
How do I selectively enable or disable debugging output?  Specifically, 
FormBuilder debugging output is simply far to verbose to be meaningful 
to us.  I suppose I could simply pass in a debug=>0 when I create the 
form.  Is there any global way?


FWIW:  I only want to surpress formbuilder output during debug.


--
Joe Landman
[EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-06 Thread Jonathan Rockway
Joe Landman wrote:
> How do I selectively enable or disable debugging output? 
> Specifically, FormBuilder debugging output is simply far to verbose to
> be meaningful to us.  I suppose I could simply pass in a debug=>0 when
> I create the form.  Is there any global way?
>
> FWIW:  I only want to surpress formbuilder output during debug. 

Unfortunately there is no way to do what you want.  Most of the plugins
(etc.) just check $c->debug to see whether or not to log via
$c->log->debug.  I suggest a filter in a custom log class (just regex
the formbuilder crap out), or fixing the plugins/controllers to check
$c->config->{pluginname_debug) or something.  Maybe we can make this
easier in 5.8; suggestions welcome.

Regards,
Jonathan Rockway






signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-06 Thread J. Shirley
On Nov 6, 2007 5:47 PM, Jonathan Rockway <[EMAIL PROTECTED]> wrote:

> Joe Landman wrote:
> > How do I selectively enable or disable debugging output?
> > Specifically, FormBuilder debugging output is simply far to verbose to
> > be meaningful to us.  I suppose I could simply pass in a debug=>0 when
> > I create the form.  Is there any global way?
> >
> > FWIW:  I only want to surpress formbuilder output during debug.
>
> Unfortunately there is no way to do what you want.  Most of the plugins
> (etc.) just check $c->debug to see whether or not to log via
> $c->log->debug.  I suggest a filter in a custom log class (just regex
> the formbuilder crap out), or fixing the plugins/controllers to check
> $c->config->{pluginname_debug) or something.  Maybe we can make this
> easier in 5.8; suggestions welcome.
>
> Regards,
> Jonathan Rockway
>
>
>
>
>
I would prefer something like:
MyApp->config(
'PluginName' => { debug = 0 }
);

Thoughts?

-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.com
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-06 Thread Jonathan Rockway
J. Shirley writes:
> I would prefer something like:
> MyApp->config(
> 'PluginName' => { debug = 0 }
> );
>
> Thoughts?

Nice.  But maybe do "Plugin::PluginName" to avoid namespace collisions.

I wonder how we can best make this approach "standard" though...

If I were nothingmuch, I would do caller magic to determine which module
is calling $c->debug, and then return true or false accordingly.  Maybe
I will try this out as a plugin, actually :)  Evil, but it will hack
around broken plugins and Just Work :)

Regards,
Jonathan Rockway



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-06 Thread Bill Moseley
On Tue, Nov 06, 2007 at 07:47:11PM -0600, Jonathan Rockway wrote:
> Joe Landman wrote:
> > How do I selectively enable or disable debugging output? 
> > Specifically, FormBuilder debugging output is simply far to verbose to
> > be meaningful to us.  I suppose I could simply pass in a debug=>0 when
> > I create the form.  Is there any global way?
> >
> > FWIW:  I only want to surpress formbuilder output during debug. 
> 
> Unfortunately there is no way to do what you want.  Most of the plugins
> (etc.) just check $c->debug to see whether or not to log via
> $c->log->debug.  I suggest a filter in a custom log class (just regex
> the formbuilder crap out), or fixing the plugins/controllers to check
> $c->config->{pluginname_debug) or something.  Maybe we can make this
> easier in 5.8; suggestions welcome.

Can't you limit what packages generate logging using log4perl?


-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-07 Thread Karim Nassar
If debugging via plugin is going to be added, it'd be super sweet if there
were support for full logging.

At my former employer, we had a logging infrastructure, but it had to work
with more than just catalyst, so it was not optimal.

I feel what is needed is the ability to log in any module such that I can
debug/log at will, and not have to worry about removing debug statements:

MyApp->config(
default_log_level => 'info+'
 => { log_level =  }
);

Then later:
package MyApp::M::Module;
sub whatever {
  # $c not usually available in Model
  MyApp::M::Module::log("static call here!");
}

More later:
package MyApp::C::Module;
sub whatever : Local {
  my ($self, $c) = @_;
  $self->log('OO Call here!');
}

We supported standard log levels:

debug
info
notice
warning
error
critical
alert
emergency

This technique would allow you to pick and choose which messages you wanted
to see, such that all of these were valid log level settings:

warning+
debug,warning,error
critical,emergency
info+

In a production environment, it'd be nice to be able to send certain log
levels through other channels as well i.e.: alternate log files or some
monitoring program's mechanism, but having the rest in place first is
extremely nice during development, and makes site monitoring easier.

--Karim Nassar

On 11/7/07, Christopher H. Laco <[EMAIL PROTECTED]> wrote:
>
> J. Shirley wrote:
> > On Nov 6, 2007 5:47 PM, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
> >
> >> Joe Landman wrote:
> >>> How do I selectively enable or disable debugging output?
> >>> Specifically, FormBuilder debugging output is simply far to verbose to
> >>> be meaningful to us.  I suppose I could simply pass in a debug=>0 when
> >>> I create the form.  Is there any global way?
> >>>
> >>> FWIW:  I only want to surpress formbuilder output during debug.
> >> Unfortunately there is no way to do what you want.  Most of the plugins
> >> (etc.) just check $c->debug to see whether or not to log via
> >> $c->log->debug.  I suggest a filter in a custom log class (just regex
> >> the formbuilder crap out), or fixing the plugins/controllers to check
> >> $c->config->{pluginname_debug) or something.  Maybe we can make this
> >> easier in 5.8; suggestions welcome.
> >>
> >> Regards,
> >> Jonathan Rockway
> >>
> >>
> >>
> >>
> >>
> > I would prefer something like:
> > MyApp->config(
> > 'PluginName' => { debug = 0 }
> > );
> >
> > Thoughts?
> >
> >
> >
> > 
> >
> > ___
> > List: Catalyst@lists.scsys.co.uk
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> > Dev site: http://dev.catalyst.perl.org/
>
> On a somewhat related note.
> While writing REST tests thius weekend, I set CATALYST_DEBUG=0, yet
> C::A::REST insisted on debugging anyway. I guess I never realized that
> you always have to check $c->debug first, and assumed $c->log->debug
> would go to the bit bucket if CATALYST_DEBUG was false.
>
> In my case, I just cheated, and had MyApp::debug do the check first to
> squelch all of the non believers.
>
> -=Chris
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-07 Thread Christopher H. Laco
J. Shirley wrote:
> On Nov 6, 2007 5:47 PM, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
> 
>> Joe Landman wrote:
>>> How do I selectively enable or disable debugging output?
>>> Specifically, FormBuilder debugging output is simply far to verbose to
>>> be meaningful to us.  I suppose I could simply pass in a debug=>0 when
>>> I create the form.  Is there any global way?
>>>
>>> FWIW:  I only want to surpress formbuilder output during debug.
>> Unfortunately there is no way to do what you want.  Most of the plugins
>> (etc.) just check $c->debug to see whether or not to log via
>> $c->log->debug.  I suggest a filter in a custom log class (just regex
>> the formbuilder crap out), or fixing the plugins/controllers to check
>> $c->config->{pluginname_debug) or something.  Maybe we can make this
>> easier in 5.8; suggestions welcome.
>>
>> Regards,
>> Jonathan Rockway
>>
>>
>>
>>
>>
> I would prefer something like:
> MyApp->config(
> 'PluginName' => { debug = 0 }
> );
> 
> Thoughts?
> 
> 
> 
> 
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/

On a somewhat related note.
While writing REST tests thius weekend, I set CATALYST_DEBUG=0, yet
C::A::REST insisted on debugging anyway. I guess I never realized that
you always have to check $c->debug first, and assumed $c->log->debug
would go to the bit bucket if CATALYST_DEBUG was false.

In my case, I just cheated, and had MyApp::debug do the check first to
squelch all of the non believers.

-=Chris



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-07 Thread Jonathan Rockway
Karim Nassar wrote:
> At my former employer, we had a logging infrastructure, but it had to
> work with more than just catalyst, so it was not optimal.

I see what you're saying, but Catalyst can easily support custom
logging.  You can make $c->log return whatever you want (see
Catalyst::Log::Log4perl for an example).  From there, you can call any
methods that you want on the object, so you can log whatever you want. 
CPAN components assume that $c->log->can(all(info debug warn error)) is
true... but you probably don't care about internal debugging information
for CPAN modules in production, so you can just turn their logging off
and only worry about messages generated by your application.

>
> I feel what is needed is the ability to log in any module such that I
> can debug/log at will, and not have to worry about removing debug
> statements:

Roll your own.

> In a production environment, it'd be nice to be able to send certain
> log levels through other channels as well i.e.: alternate log files or
> some monitoring program's mechanism, but having the rest in place
> first is extremely nice during development, and makes site monitoring
> easier.

log4perl does this.

Hope this points you in the right direction.  Let me know if I'm
completely off-base here :)

Regards,
Jonathan Rockway

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-07 Thread Karim Nassar
Thanks for the links! Looks like Log4Perl does what I need. Wish I knew that
6 months ago... :-/

Karim Nassar

On 11/7/07, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
>
> Karim Nassar wrote:
> > At my former employer, we had a logging infrastructure, but it had to
> > work with more than just catalyst, so it was not optimal.
>
> I see what you're saying, but Catalyst can easily support custom
> logging.  You can make $c->log return whatever you want (see
> Catalyst::Log::Log4perl for an example).  From there, you can call any
> methods that you want on the object, so you can log whatever you want.
> CPAN components assume that $c->log->can(all(info debug warn error)) is
> true... but you probably don't care about internal debugging information
> for CPAN modules in production, so you can just turn their logging off
> and only worry about messages generated by your application.
>
> >
> > I feel what is needed is the ability to log in any module such that I
> > can debug/log at will, and not have to worry about removing debug
> > statements:
>
> Roll your own.
>
> > In a production environment, it'd be nice to be able to send certain
> > log levels through other channels as well i.e.: alternate log files or
> > some monitoring program's mechanism, but having the rest in place
> > first is extremely nice during development, and makes site monitoring
> > easier.
>
> log4perl does this.
>
> Hope this points you in the right direction.  Let me know if I'm
> completely off-base here :)
>
> Regards,
> Jonathan Rockway
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-07 Thread Balaji Srinivasan

The way to do this would be to:
__PACKAGE__->config->{'Controller::FormBuilder'}->{new}={ debug=> 0};
Add this line to the controllers that use FormBuilder and it should  
supress all form builder output

Balaji

On Nov 6, 2007, at 3:59 PM, Joe Landman wrote:

How do I selectively enable or disable debugging output?   
Specifically, FormBuilder debugging output is simply far to verbose  
to be meaningful to us.  I suppose I could simply pass in a debug=>0  
when I create the form.  Is there any global way?


FWIW:  I only want to surpress formbuilder output during debug.


--
Joe Landman
[EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Selective debug output

2007-11-13 Thread Jason Kohles

On Nov 6, 2007, at 6:59 PM, Joe Landman wrote:

How do I selectively enable or disable debugging output?   
Specifically, FormBuilder debugging output is simply far to verbose  
to be meaningful to us.  I suppose I could simply pass in a debug=>0  
when I create the form.  Is there any global way?


FWIW:  I only want to surpress formbuilder output during debug.

Log4perl and Catalyst::Log::Log4perl make this trivial, here is a bit  
of the configuration from my log4perl.conf...


# Set the default to get everything at level DEBUG or above, and  
output to the appender named Screen

log4perl.logger=DEBUG,Screen
# For Catalyst::Plugin::Authorization and subclasses, only log at  
level ERROR or above

log4perl.logger.Catalyst.Plugin.Authorization=ERROR,Screen
# Same for Catalyst::Plugin::Session
log4perl.logger.Catalyst.Plugin.Session=ERROR,Screen
# Define a logger called Screen that logs to stderr, and that color  
codes the output by level

log4perl.appender.Screen=Log::Log4perl::Appender::ScreenColoredLevels
log4perl.appender.Screen.stderr=1
log4perl.appender.Screen.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.Screen.layout.ConversionPattern=%p[%c] %m%n

--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/