|
Posted by Richard Lynch on 10/04/74 11:10
> 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.
> Code I use (php5 on unix):
> *********************************************
> #!/usr/local/php/bin/php -q
> <?php
> error_log("My error message");
> ?>
> *********************************************
> OUTPUT:
> $ test.php
> My error message
> $
>
> How can I prevent the error messages from being echoed to the client?
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|