I have fabric 0.9.2 running on Ubuntu, and I want to be able to capture whatever is printed to the console to a file as well. So here's what I did:

1. Modify /usr/local/bin/fab's #! line to have unbuffered output, like so:

        #!/usr/local/bin/python -u

2. Create a shell script named myfab that goes something like this:

        #!/usr/bin/env bash
        fab $* | tee log/`date +%FT%Hh%Mm%Ss`.log

Now, whenever I run myfab instead of fab, the output is shown on screen as well as captured in a timestamped log file.

However, there is a drawback in that stderr is not captured, such that if my fab script bombs out, the error message is absent from the log file. This is acceptable for now, though, since deployments are to be automated, but not unattended, IMHO.

--

On Oct 18, 2010, at 9:35 AM, Jeff Honey wrote:

I've looked through the API docs and am scratching my head here. How do I capture Fabric's output to STDOUT and put it in a file? I know I can just do a simple redirection within the cmdline statement but I need to take that output and stick it in an email, the code for which is included in the function.

The email code I've got just uses smtplib and pulls in a txt file.


--
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤ kyoboku kazeoshi ¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to