views:

275

answers:

4

Hi,

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
A: 

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.

Chisum
Was this useful? If not I can remove.
Chisum
A: 

Have you looked at the PEAR mail packages?

David W
+1  A: 

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.

raphaelstolt
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 ;-)
Pascal MARTIN
+1  A: 

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

Michiel
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 ;-)
Pascal MARTIN