Re: xmlrpc

will <[email protected]> Fri, 16 Nov 2007 11:34:07 -0500
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Blake Winton wrote:
> Lance Levsen wrote:
>> xmlrpc.py doesn't seem to have any logging options so I can't get more
>> info on that. The only difference between the two xmlrpc.py plugins I
>> have (one working, one not) is comments in the plugin so I don't think
>> it's a plug-in issue.
> 
> One of the nice things about Python is that you can add your own logging...
> 
> I don't use xmlrpc.py, but you should be able to add lines of the form:
> print >> sys.stderr, "My message goes here!"
> and have them print to your webserver's error logs...
> 
> (Usually I hate it when people say stuff like that to me, but in this case, I
>   really think that might be the easiest way for you to get your stuff
>   working...  And if you do add logging stuff, you might want to wrap it in some
>   sort of if-statement, and submit it back to use, for the next person who has
>   problems with the plugin... )

Or you can use PyBlosxom's built-in logging stuff:

    blah blah blah

    logger = tools.get_logger()
    logger.info("this message goes to the log")

Then you don't have to worry about blocking it out--if the user has set 
their logging level to something higher than INFO, then it won't show up 
in their log.  I think the default is ERROR.

If you skulk around, there should be lots of usage of the logging.  It 
uses the Python logging module if it's available.

/will

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/