[Zope] Re: filter messages at startup

Chris McDonough chrism at plope.com
Tue Jun 13 17:06:59 EDT 2006


On Jun 13, 2006, at 11:05 AM, Florent Guillaume wrote:

> thomas desvenain wrote:
>> i mean i would like to filter warning/error messages that appears  
>> in console
>> when starting zope server or debugger
>> in order to ignore those i'm not interested with for the moment
>> for instance :
>> [root at biow3 tests]# /zope/test/bin/zopectl debug
>> Starting debugger (the name "app" is bound to the top-level Zope  
>> object)
>> 2006-06-13 13:48:34 WARNING Init Class
>> Products.CMFCore.PortalContent.PortalContent has a security  
>> declaration for
>> nonexistent method 'manage_FTPget'
>> 2006-06-13 13:48:34 WARNING Init Class
>> Products.CMFCore.PortalContent.PortalContent has a security  
>> declaration for
>> nonexistent method 'manage_FTPget'
>> etc
>
> Not out of the box.


Actually, there is a way, but it's a bit heavy-handed and imprecise.   
In zope.conf, do (untested):

<warnfilter>
  action ignore
  message .*has a security declaration for.*
</warnfilter>

Here's the ZConfig schema description of the "warnfilter" element:

   <multisection type="warnfilter" attribute="warnfilters" name="*"
                 dataype="zLOG.warn_filter_handler">
     <!-- from zLOG -->
     <description>
     A multisection which allows a user to set up a Python "warning"  
filter.
     The following keys are valid within a warnfilter section:

       action:  one of the following strings:

            "error"   turn matching warnings into exceptions
            "ignore"  never print matching warnings
            "always"  always print matching warnings
            "default" print the first occurrence of matching warnings
                      for each location where the warning is issued
            "module"  print the first occurrence of matching warnings
                      for each module where the warning is issued
            "once"    print only the first occurrence of matching
                      warnings, regardless of location

       message:  a string containing a regular expression that the
                 warning message must match (the match is compiled to
                 always be case-insensitive)

       category: a Python dotted-path classname (must be a subclass of
                 Warning) of which the warning category must be a  
subclass in
                 order to match

       module:   a string containing a regular expression that the
                 module name must match (the match is compiled to be
                 case-sensitive)

       lineno:   an integer that the line number where the warning
                 occurred must match, or 0 to match all line numbers
     </description>
   </multisection>


- C



More information about the Zope mailing list