Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
Hi, There's now a request for this: https://bugs.php.net/bug.php?id=55109 Colours are now toggled by the ini setting cli_server.color. I'm still looking into means of excluding the more deceptively incapable terminals but I will support having colours on by default anyway. Regards, Arpad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Thu, 2011-06-30 at 07:08 +0200, David Zülke wrote: On 29.06.2011, at 01:19, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). The code could detect if it's outputting to a TTY or not and only use color codes if the output isn't redirected somewhere else. It *is* checking this. And I showed an example (script(1)) where the environment pretends to be a TTY and isn't. My suggestion was to add an ini option in addition to the check. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Thu, 30 Jun 2011, Johannes Schlüter wrote: On Thu, 2011-06-30 at 07:08 +0200, David Zülke wrote: On 29.06.2011, at 01:19, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). The code could detect if it's outputting to a TTY or not and only use color codes if the output isn't redirected somewhere else. It *is* checking this. And I showed an example (script(1)) where the environment pretends to be a TTY and isn't. My suggestion was to add an ini option in addition to the check. I'm fine with that, but let's leave it set to 1 by default? People with complex requirements can then turn it off if they want to. regards, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On 30 June 2011 12:24, Derick Rethans der...@php.net wrote: On Thu, 30 Jun 2011, Johannes Schlüter wrote: On Thu, 2011-06-30 at 07:08 +0200, David Zülke wrote: On 29.06.2011, at 01:19, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). The code could detect if it's outputting to a TTY or not and only use color codes if the output isn't redirected somewhere else. It *is* checking this. And I showed an example (script(1)) where the environment pretends to be a TTY and isn't. My suggestion was to add an ini option in addition to the check. I'm fine with that, but let's leave it set to 1 by default? People with complex requirements can then turn it off if they want to. regards, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php In Windows, there is no default colouring support at the console, so it would make sense if it was off by default. I use a tool called ANSICon which provides the colouring support (http://en.wikipedia.org/wiki/ANSI_escape_code#Support and source+bins at http://adoxa.110mb.com/ansicon/). So, for me turning it on would work for me. Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
agreed, it should be optional and off by default. PHP never had such feature either. 2011/6/30 Johannes Schlüter johan...@schlueters.de: On Thu, 2011-06-30 at 07:08 +0200, David Zülke wrote: On 29.06.2011, at 01:19, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). The code could detect if it's outputting to a TTY or not and only use color codes if the output isn't redirected somewhere else. It *is* checking this. And I showed an example (script(1)) where the environment pretends to be a TTY and isn't. My suggestion was to add an ini option in addition to the check. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
Instead of adding it as a php ini option, please consider adding this as a parameter to the php-cli executable as this might be something you would want to enable/disable quickly per instance. This would also make the coloring output more attractive to use instead of having to edit the ini file every time or have a seperate ini file just for the purpose to enable or disable coloring Den 30/06/2011 12.54 skrev Johannes Schlüter johan...@schlueters.de:
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Thu, Jun 30, 2011 at 20:14, Lars Bo Rasmussen l...@k0ngehuset.dk wrote: Instead of adding it as a php ini option, please consider adding this as a parameter to the php-cli executable as this might be something you would want to enable/disable quickly per instance. This would also make the coloring output more attractive to use instead of having to edit the ini file every time or have a seperate ini file just for the purpose to enable or disable coloring Then you would be forced to always pass that option. If you want to enable it for one run you could do php -dcli.color=0 foo.php No need to edit the ini. -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On 06/30/2011 12:04 PM, Hannes Magnusson wrote: On Thu, Jun 30, 2011 at 20:14, Lars Bo Rasmussenl...@k0ngehuset.dk wrote: Instead of adding it as a php ini option, please consider adding this as a parameter to the php-cli executable as this might be something you would want to enable/disable quickly per instance. This would also make the coloring output more attractive to use instead of having to edit the ini file every time or have a seperate ini file just for the purpose to enable or disable coloring Then you would be forced to always pass that option. If you want to enable it for one run you could do php -dcli.color=0 foo.php No need to edit the ini. -Hannes If we have to have colouring at all, then I'd prefer a php.ini option to a command line option. The default should be coded Off, but can be set On in the php.ini-development file we ship. Preferably the parameter would be non-binary. This allows someone to extend it, including adding alternative colour schemes for the red-green impaired person: cli.webserver_log = COLOR_NONE cli.webserver_log = COLOR_REDGREEN ; uses red green cli.webserver_log = COLOR_YELLOWBLUE ; uses yellow blue cli.webserver_log = COLOR_REDGREEN | ERRORS_ONLY ; you get the idea Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Wed, 29 Jun 2011, Jérôme Loyet wrote: 2011/6/29 Johannes Schlüter johan...@schlueters.de: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). I agree with johannes. Color should be an option, all term does not handle them correctly. Also, color control sequences are just killing a log file. That's why the patch first checks whether stdout is actually a tty, so your log file will not have ansi control characters. Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Wed, 2011-06-29 at 11:45 +0100, Derick Rethans wrote: That's why the patch first checks whether stdout is actually a tty, so your log file will not have ansi control characters. While that check is not always the best/good thing. For instance if you're using script(1) to log a terminal session you will end up with a log file with control sequences. Script started on June 29, 2011 12:59:59 PM CEST $ cat test.c #include unistd.h int main() { printf(%i\n, isatty(STDOUT_FILENO)); return 0; } $ gcc -otest test.c $ ./test 1 $ exit script done on June 29, 2011 01:02:11 PM CEST And then there are people using strange backgrounds or have trouble identifying specific colors - so I think it should be made optional. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
hi, Good idea :) However I would prefer to have that enabled optionally. CLI is widely used for automated tasks with logs created using std* redirects. I would not like to have the color escape codes in these logs. Also please open a FR at bugs.php.net and attach the patch(es) to it, thanks! Cheers, On Wed, Jun 29, 2011 at 12:37 AM, Arpad Ray array...@gmail.com wrote: Hi, This little patch makes the following changes to the CLI web server's console logging: - Compacts messages to one line, so a 404 doesn't occupy three lines. - Includes the response status code - Colours messages according to their response code (success=green, client error=yellow, server error=red) - Appends the error message when there's a fatal PHP error Here's an example: http://spellign.com/patches/cli-before.png http://spellign.com/patches/cli-after.png And the patch: http://spellign.com/patches/php-trunk-cli-server-messages.patch I'd appreciate any feedback. Regards, Arpad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On 29.06.2011, at 01:19, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). The code could detect if it's outputting to a TTY or not and only use color codes if the output isn't redirected somewhere else. David smime.p7s Description: S/MIME cryptographic signature
[PHP-DEV] [PATCH] Friendly log messages for CLI server
Hi, This little patch makes the following changes to the CLI web server's console logging: - Compacts messages to one line, so a 404 doesn't occupy three lines. - Includes the response status code - Colours messages according to their response code (success=green, client error=yellow, server error=red) - Appends the error message when there's a fatal PHP error Here's an example: http://spellign.com/patches/cli-before.png http://spellign.com/patches/cli-after.png And the patch: http://spellign.com/patches/php-trunk-cli-server-messages.patch I'd appreciate any feedback. Regards, Arpad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Wed, Jun 29, 2011 at 12:37 AM, Arpad Ray array...@gmail.com wrote: Hi, This little patch makes the following changes to the CLI web server's console logging: - Compacts messages to one line, so a 404 doesn't occupy three lines. - Includes the response status code - Colours messages according to their response code (success=green, client error=yellow, server error=red) - Appends the error message when there's a fatal PHP error Here's an example: http://spellign.com/patches/cli-before.png http://spellign.com/patches/cli-after.png And the patch: http://spellign.com/patches/php-trunk-cli-server-messages.patch I'd appreciate any feedback. Regards, Arpad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php I would love to have this. :) Tyrael -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
2011/6/29 Johannes Schlüter johan...@schlueters.de: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). I agree with johannes. Color should be an option, all term does not handle them correctly. Also, color control sequences are just killing a log file. ++ Jerome -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Friendly log messages for CLI server
On 06/28/2011 04:19 PM, Johannes Schlüter wrote: On Tue, 2011-06-28 at 23:37 +0100, Arpad Ray wrote: - Colours messages according to their response code (success=green, client error=yellow, server error=red) I would prefer if this would be an ini option (if (cli_web_server.color isatty) color = true) default can be on, but I've seen cases where such magic failed and created hard-to use results (due to control sequences in log files or such). johannes I'm -1 on the color coding for a few reasons: (i) it can be done outside of PHP (ii) forcing a particular color coding is problematic for many users (iii) the escape codes are not portable. The other items in the patch have merit. If you're looking at the web server code, perhaps you can sort out the issues with subdirectories and include()? Moriyoshi has gone quiet on it. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php