Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18350 > unrolled thread

where does the output of error_log(... ,4)?

Started byHostel <f@f.f>
First post2020-08-26 18:53 +0200
Last post2022-07-06 09:21 -0700
Articles 12 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  where does the output of error_log(... ,4)? Hostel <f@f.f> - 2020-08-26 18:53 +0200
    Re: where does the output of error_log(... ,4)? "J.O. Aho" <user@example.net> - 2020-08-27 11:06 +0200
    Re: where does the output of error_log(... ,4)? Arno Welzel <usenet@arnowelzel.de> - 2020-08-30 14:21 +0200
      Re: where does the output of error_log(... ,4)? Hostel <f@f.f> - 2020-09-01 12:36 +0200
        Re: where does the output of error_log(... ,4)? Arno Welzel <usenet@arnowelzel.de> - 2020-09-02 10:18 +0200
          Re: where does the output of error_log(... ,4)? Hostel <f@f.f> - 2020-09-03 16:50 +0200
            Re: where does the output of error_log(... ,4)? Arno Welzel <usenet@arnowelzel.de> - 2020-09-04 12:41 +0200
              Re: where does the output of error_log(... ,4)? Hostel <f@f.f> - 2020-09-05 08:57 +0200
                Re: where does the output of error_log(... ,4)? "J.O. Aho" <user@example.net> - 2020-09-05 12:26 +0200
                  Re: where does the output of error_log(... ,4)? Hostel <f@f.f> - 2020-09-05 15:46 +0200
                Re: where does the output of error_log(... ,4)? Arno Welzel <usenet@arnowelzel.de> - 2020-09-05 15:47 +0200
    Re: where does the output of error_log(... ,4)? Ace of diamonds <he12091983@gmail.com> - 2022-07-06 09:21 -0700

#18350 — where does the output of error_log(... ,4)?

FromHostel <f@f.f>
Date2020-08-26 18:53 +0200
Subjectwhere does the output of error_log(... ,4)?
Message-ID<ri642s$1f2a$1@gioia.aioe.org>
<?php // index.php (http://localhost)
error_log(
     'abc123',
     4 // message is sent directly to the SAPI logging handler
);

What does it mean message is sent directly to the SAPI logging handler?
Where does the output?

The page http://localhost it displays nothing!!!

[toc] | [next] | [standalone]


#18351

From"J.O. Aho" <user@example.net>
Date2020-08-27 11:06 +0200
Message-ID<hqpbckF175lU1@mid.individual.net>
In reply to#18350
On 26/08/2020 18.53, Hostel wrote:
> <?php // index.php (http://localhost)
> error_log(
>      'abc123',
>      4 // message is sent directly to the SAPI logging handler
> );
> 
> What does it mean message is sent directly to the SAPI logging handler?
> Where does the output?

The SAPI is a or a collection of interfaces that lies between php and 
the web service. One of them will be used to send the error message to 
the logger instance, which in most Linux cases would be a syslog service 
or journald

> The page http://localhost it displays nothing!!!

error_log do not display anything, it's to send en error log based on 
the message_type defined. See 
https://www.php.net/manual/en/function.error-log.php

I would suggest you look in your system logs, most likely in 
/var/log/messages or /var/log/syslog depending on your distribution, 
with systemd/Linux you may also try the run the following command:
journalctl -a


For people who like to pay for a crippled OS, then use the eventvwr

-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#18352

FromArno Welzel <usenet@arnowelzel.de>
Date2020-08-30 14:21 +0200
Message-ID<hr1jtpFne7iU1@mid.individual.net>
In reply to#18350
Hostel:

> <?php // index.php (http://localhost)
> error_log(
>      'abc123',
>      4 // message is sent directly to the SAPI logging handler
> );
> 
> What does it mean message is sent directly to the SAPI logging handler?
> Where does the output?

You should find the messages in the error log of your webserver.

Also see: <https://www.php.net/manual/en/function.error-log.php>


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18354

FromHostel <f@f.f>
Date2020-09-01 12:36 +0200
Message-ID<ril877$1dit$1@gioia.aioe.org>
In reply to#18352
Il 30/08/20 14:21, Arno Welzel ha scritto:
> Hostel:
> 
>> <?php // index.php (http://localhost)
>> error_log(
>>       'abc123',
>>       4 // message is sent directly to the SAPI logging handler
>> );
>>
>> What does it mean message is sent directly to the SAPI logging handler?
>> Where does the output?
> 
> You should find the messages in the error log of your webserver.
> 
> Also see: <https://www.php.net/manual/en/function.error-log.php>
> 
> 

mmmhhhhhhh...

var_dump(
	ini_set('error_log', 'err.log'),
	$file = ini_get('error_log'),
	error_log('abc', 4),
	file_exists($file)
);

string(0) ""
string(50) "err.log"
bool(true)
bool(false)

[toc] | [prev] | [next] | [standalone]


#18355

FromArno Welzel <usenet@arnowelzel.de>
Date2020-09-02 10:18 +0200
Message-ID<hr92qtFa6rbU1@mid.individual.net>
In reply to#18354
Hostel:

> Il 30/08/20 14:21, Arno Welzel ha scritto:
>> Hostel:
>>
>>> <?php // index.php (http://localhost)
>>> error_log(
>>>       'abc123',
>>>       4 // message is sent directly to the SAPI logging handler
>>> );
>>>
>>> What does it mean message is sent directly to the SAPI logging handler?
>>> Where does the output?
>>
>> You should find the messages in the error log of your webserver.
>>
>> Also see: <https://www.php.net/manual/en/function.error-log.php>
>>
>>
> 
> mmmhhhhhhh...
> 
> var_dump(
> 	ini_set('error_log', 'err.log'),
> 	$file = ini_get('error_log'),
> 	error_log('abc', 4),
> 	file_exists($file)
> );
> 
> string(0) ""
> string(50) "err.log"
> bool(true)
> bool(false)

Setting the error_log to the name 'err.log' is not enough. This must be
a full path and it must be writable by the user which executes the PHP
script (usually www-data, but that depends on your setup). Otherwise PHP
does not know where to put this file.

Also see
<https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log>


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18356

FromHostel <f@f.f>
Date2020-09-03 16:50 +0200
Message-ID<riqvr3$1cai$1@gioia.aioe.org>
In reply to#18355
Il 02/09/20 10:18, Arno Welzel ha scritto:
> Setting the error_log to the name 'err.log' is not enough. This must be
> a full path and it must be writable by the user which executes the PHP
> script (usually www-data, but that depends on your setup). Otherwise PHP
> does not know where to put this file.
> 
> Also see
> <https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log>

the path is complete.
I removed the initial part for privacy reasons

[toc] | [prev] | [next] | [standalone]


#18357

FromArno Welzel <usenet@arnowelzel.de>
Date2020-09-04 12:41 +0200
Message-ID<hrejusFf5soU1@mid.individual.net>
In reply to#18356
Hostel:

> Il 02/09/20 10:18, Arno Welzel ha scritto:
>> Setting the error_log to the name 'err.log' is not enough. This must be
>> a full path and it must be writable by the user which executes the PHP
>> script (usually www-data, but that depends on your setup). Otherwise PHP
>> does not know where to put this file.
>>
>> Also see
>> <https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log>
> 
> the path is complete.
> I removed the initial part for privacy reasons

And the user which runs the PHP script (www-data) has write access to
that path?


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18358

FromHostel <f@f.f>
Date2020-09-05 08:57 +0200
Message-ID<rivcsh$kre$1@gioia.aioe.org>
In reply to#18357
Il 04/09/20 12:41, Arno Welzel ha scritto:
> Hostel:
> 
>> Il 02/09/20 10:18, Arno Welzel ha scritto:
>>> Setting the error_log to the name 'err.log' is not enough. This must be
>>> a full path and it must be writable by the user which executes the PHP
>>> script (usually www-data, but that depends on your setup). Otherwise PHP
>>> does not know where to put this file.
>>>
>>> Also see
>>> <https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log>
>>
>> the path is complete.
>> I removed the initial part for privacy reasons
> 
> And the user which runs the PHP script (www-data) has write access to
> that path?
> 
> 

ini_set(
     'error_log',
     __DIR__ . '/err.log'
);

$data = [
     "error_log('abc', 4)"
         => error_log('abc', 4),
     "file_exists(ini_get('error_log'))"
         => file_exists(ini_get('error_log')),
     "is_writable(__DIR__)"
         => is_writable(__DIR__),
];

var_dump($data);

Output:

array(3) {
   ["error_log('abc', 4)"]=>
   bool(true)
   ["file_exists(ini_get('error_log'))"]=>
   bool(false)
   ["is_writable(__DIR__)"]=>
   bool(true)
}

[toc] | [prev] | [next] | [standalone]


#18359

From"J.O. Aho" <user@example.net>
Date2020-09-05 12:26 +0200
Message-ID<hrh7dqF1bt3U1@mid.individual.net>
In reply to#18358
On 05/09/2020 08.57, Hostel wrote:
> Il 04/09/20 12:41, Arno Welzel ha scritto:
>> Hostel:
>>
>>> Il 02/09/20 10:18, Arno Welzel ha scritto:
>>>> Setting the error_log to the name 'err.log' is not enough. This must be
>>>> a full path and it must be writable by the user which executes the PHP
>>>> script (usually www-data, but that depends on your setup). Otherwise 
>>>> PHP
>>>> does not know where to put this file.
>>>>
>>>> Also see
>>>> <https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log> 
>>>>
>>>
>>> the path is complete.
>>> I removed the initial part for privacy reasons
>>
>> And the user which runs the PHP script (www-data) has write access to
>> that path?
>>
>>
> 
> ini_set(
>      'error_log',
>      __DIR__ . '/err.log'
> );
> 
> $data = [
>      "error_log('abc', 4)"
>          => error_log('abc', 4),

You are telling the error logging system to use SAPI, this will let the 
web service to handle the log, look among your Apache logs.

I think you want to use "error_log('abc', 3)" to redirect the log to 
your log file.

If you have full control of the system that the script will be run on, I 
think syslog() is better way to log, you can redirect logs based on id 
and level to different files and on a high usage site syslog is far 
superior when it comes to write to disk than simple file write from php.

[toc] | [prev] | [next] | [standalone]


#18360

FromHostel <f@f.f>
Date2020-09-05 15:46 +0200
Message-ID<rj04qr$1vnc$1@gioia.aioe.org>
In reply to#18359
Il 05/09/20 12:26, J.O. Aho ha scritto:
> 
> You are telling the error logging system to use SAPI, this will let the 
> web service to handle the log, look among your Apache logs.

Found it: /var/log/httpd/apache24-error_log

> I think you want to use "error_log('abc', 3)" to redirect the log to 
> your log file.
> 
> If you have full control of the system that the script will be run on, I 
> think syslog() is better way to log, you can redirect logs based on id 
> and level to different files and on a high usage site syslog is far 
> superior when it comes to write to disk than simple file write from php.

Thanks for the info!!!

[toc] | [prev] | [next] | [standalone]


#18361

FromArno Welzel <usenet@arnowelzel.de>
Date2020-09-05 15:47 +0200
Message-ID<hrhj7iF3nfuU1@mid.individual.net>
In reply to#18358
Hostel:

> Il 04/09/20 12:41, Arno Welzel ha scritto:
>> Hostel:
>>
>>> Il 02/09/20 10:18, Arno Welzel ha scritto:
>>>> Setting the error_log to the name 'err.log' is not enough. This must be
>>>> a full path and it must be writable by the user which executes the PHP
>>>> script (usually www-data, but that depends on your setup). Otherwise PHP
>>>> does not know where to put this file.
>>>>
>>>> Also see
>>>> <https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log>
>>>
>>> the path is complete.
>>> I removed the initial part for privacy reasons
>>
>> And the user which runs the PHP script (www-data) has write access to
>> that path?
>>
>>
> 
> ini_set(
>      'error_log',
>      __DIR__ . '/err.log'
> );
> 
> $data = [
>      "error_log('abc', 4)"

I hoverlooked this - you say "use SAPI" and not "log to file"!

See <https://www.php.net/manual/en/function.error-log.php>, second
parameter. If you want the log message to go to the file this must be 3
not 4:

error_log('some message', 3);



-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#19039

FromAce of diamonds <he12091983@gmail.com>
Date2022-07-06 09:21 -0700
Message-ID<423f466f-4f63-44ab-a3b8-958bfddb3d84n@googlegroups.com>
In reply to#18350
Hey guy. Would You want to get rich with me doing programming? If yes, call me !!!!!!!!!

✆☎☏📱📞 : 372 53900660


Hostel kirjutas Kolmapäev, 26. august 2020 kl 18:53:56 UTC+2:
> <?php // index.php (http://localhost) 
> error_log( 
> 'abc123', 
> 4 // message is sent directly to the SAPI logging handler 
> ); 
> 
> What does it mean message is sent directly to the SAPI logging handler? 
> Where does the output? 
> 
> The page http://localhost it displays nothing!!!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web