On Fri, 21 Oct 2022, Mikhail Galanin via internals wrote:

> (4) Derrek Rethans suggested introducing a new function (e.g.
> php_format_date_ex) that
>      takes care of usecs (see the thread on Github)

It's 'Derick' :-)

> Looking into the future, probably we would like to have this format 
> configurable, if so it looks easy to do but still I can't see an easy 
> way to handle the microseconds issue.

Making things configurable requires an ini setting, which we generally 
don't like to add. It wouldn't really work in this situation, as 
warnings/errors happen either before or during INI file parsing, meaning 
that it can't (yet) use the new format.

> Could you please help me to find the right way and share your thoughts 
> about this topic (maybe there are strong objections against such a 
> change)?

I don't think we should change anything in PHP. Instead, use your 
system's syslog. You can configure PHP to send all warnings to syslog by 
setting "log_errors=1 error_log=syslog" in PHP.ini. In order to separate 
out just the PHP issues, you can also set "syslog.facility=local1" (or 
any other local).

On Unix systems, you can configure syslog to add milliseconds to the log 
file messages. See  https://askubuntu.com/a/1266114

If your system already uses systemd and journald, then you don't have to 
use any configuration settings, and you can query the journal with:

journalctl -o short-iso-precise -r --facility=local1

A PHP warning would show up in there, with something like:

$ sudo journalctl -o short-iso-precise -r --facility=local1
2022-11-28T16:06:53.862980+0000 gargleblaster php[3143059]: PHP Warning:  
Undefined variable $fasd in Command line code on line 1

cheers,
Derick

-- 
https://derickrethans.nl | https://xdebug.org | https://dram.io
Author of Xdebug. Like it? Consider supporting me: https://xdebug.org/support
Host of PHP Internals News: https://phpinternals.news
mastodon: @derickr@phpc.social @xdebug@phpc.social
twitter: @derickr and @xdebug

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to