phing : sending the full log by email?
Asked Answered
P

5

6

I'm using phing for some automatic-building process on a project, and was wondering : how can I get the full log by email ?


When I launch phing by the command-line, the building-log is displayed ; I would like it :

  • sent by e-mail,
  • to several recipients,
  • whether the build succeeded or failed
  • ideally : with a subject for the mail telling if the build succeeded or failed
  • ideally : some kind of HTML mail, with formatting, colors, ... would be nice

I've though about piping the ouput of phing to the mail command, but I would like a solution that work on both Linux and Windows, and doesn't require the installation of any additional software...

Does anyone have an idea ?


As a sidenote : I've thought about adding some kind of "report" target, launched at the end of the build, but :

  • It is launched only if all previous targets did not fail
  • I don't see how to get the full-log in it
Penetrating answered 12/9, 2009 at 11:19 Comment(0)
O
4

Great idea; just added a ticket to implement this @ http://phing.info/trac/ticket/539

Omit answered 2/9, 2010 at 10:15 Comment(1)
Hi, glad to see you here ^^ ;; I totally had forgotten this question, since the end of the project I needed that for... But, still, pretty sure this will be useful to someone one day or another ;-)Penetrating
P
3

I guess you could write a custom Phing build listener / logger handling your described use case. Take a look at this excellent blog post by Philip Norton, to get you going.

Perforated answered 26/11, 2009 at 10:2 Comment(1)
Thanks for this answer ! It's a bit late now (the project I was working on is finished ^^ ), but I might try one day or another, just to know how I can get this to work ;-)Penetrating
A
0

This is something you can do without the installation of additional software assuming you are able to write a script for a linux server you have access to.

Have a php script use the exec() or system() command to obtain the full log. Send this as http post data using curl to your remote script on the linux server you have access to.

On the server you have access to write a script to accept the http post variable and mail the content to your email address(es). And you might think "Oh no, I have open access to people emailing me!" If they know your address or you have a web contact form... same deal. So that is a solution ;) If security's a concern send it via https.

Attrahent answered 27/10, 2009 at 4:53 Comment(1)
Was this useful? If not I can remove.Attrahent
I
0

We use sth. like this wrapped in a php script.

exec('phing' . $target . ' -f ' . $buildfile . ' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"', $out); //remove bash color
$info = implode("\n", $out);
$subj = sprintf('Deployed %s', $catalogInfo['name']);
mail($data->email, $subj, $info); 

Works fine.

Ial answered 9/8, 2011 at 19:36 Comment(0)
V
-2

Have you looked at the PEAR mail packages?

Villa answered 24/11, 2009 at 4:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.