Re: shell script - disable log output
| From: | Eli | Date: | Wed, 09 Mar 2005 22:28:29 +0000 |
| Subject: | Re: shell script - disable log output | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-210382@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
I don't really need it to log into a file, but I wanted to prevent it from echoing to the screen. So I guess there's no way to prevent from error_log() (using defaults) to echo to the screen (STDOUT). error_reporting() affects on errors produced by PHP itself. I tried to set it to 0 before the call, but it didn't help. set_error_handler() affects on trigger_error() and not on error_log(). It seems that the extern lib I use should use trigger_error() (or user_error()) function instead, which is the traditional way to report user-defined errors. Thanks for your help all...I'm writing a shell script that uses error_log function to log some data, but it echos the error message to the output without logging the message to the log file."the log file"... *WHAT* log file? A shell script has no pre-determined log file, really. Actually, it's almost for sure STDOUT at that point, or maybe STDOUT, but I doubt it. If you were coding PHP engine and needed to send error output somewhere under shell circumstances, you'd think STDOUT would be "it" right?... So you can probably re-direct 2 (STDOUT) to somewhere to get the error_log output where you want it. I think in most shells that turns into: test.php 2> /var/log/test YMMV It's up to you to figure out re-directs in your shell of choice. Good luck. You should probably use can use set_error_handler to trap errors -- though that will not catch error_log output, I don't think. You can also use set_error_reporting() to get rid of errors entirely, though that's not recommended.