fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Getting the logs from a Python call


From: Xavier Ordoquy
Subject: Re: [Fab-user] Getting the logs from a Python call
Date: Thu, 25 Nov 2010 10:17:34 +0100

Hi Jeff,

Thank you for your answer.
I'll keep things as they are now and get the traces in the web server's logs.
If I manage to get some time, I'll probably move the print statements to use 
logging but it might not be before a couple of months...

Regards,
Xavier.

Le 24 nov. 2010 à 17:18, Jeff Forcier a écrit :

> Hi Xavier,
> 
> Right now Fabric just prints those lines to sys.stdout or sys.stderr
> and doesn't use an actual logging module, though doing so is planned
> for the near future.
> 
> So if you're running Fabric as a library, you'll need to either hide
> those lines so they don't print out (see the "output controls" usage
> docs) or temporarily mock sys.stdout / sys.stderr, which is kind of
> ugly, but should work depending on what else you're doing with them in
> non-Fabric code.
> 
> For example, Fab's own test suite does something like this:
> 
>    https://github.com/bitprophet/fabric/blob/master/tests/utils.py#L71
> 
> You could probably adapt that sort of thing into a context manager and
> thus do e.g.:
> 
>    with captured_stdout():
>        run('foo') # This won't actually get printed, only stored
>        log(sys.stdout.getvalue()) # If using StringIO like the above code
>    print "yay" # This would print since sys.stdout is not mocked here
> 
> 
> Hope that helps,
> Jeff
> 
> On Wed, Nov 24, 2010 at 2:17 AM, Xavier Ordoquy <address@hidden> wrote:
>> Hi there,
>> 
>> I have integrated fabric to a web based deployment application.
>> Things seem to have taken a good shape with one exception. I can't find how 
>> I can get the console output from the command calls.
>> I mean, I can get the command results but I can't understand how I could 
>> capture all the traces fabric outputs to the console in order to "redirect" 
>> them to the logging utilities.
>> 
>> Does anyone have an idea/tip that could help me ?
>> 
>> Regards,
>> Xavier.
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>> 
> 
> 
> 
> -- 
> Jeff Forcier
> Unix sysadmin; Python/Ruby engineer
> http://bitprophet.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]