Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119046 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66001 invoked from network); 28 Nov 2022 16:13:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Nov 2022 16:13:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E608C180538 for ; Mon, 28 Nov 2022 08:13:01 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/20 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Mon, 28 Nov 2022 08:13:01 -0800 (PST) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 8037F10C055; Mon, 28 Nov 2022 16:13:00 +0000 (GMT) Date: Mon, 28 Nov 2022 16:13:00 +0000 (GMT) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Mikhail Galanin cc: internals@lists.php.net In-Reply-To: Message-ID: References: User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [PHP-DEV] Microseconds to error log From: derick@php.net (Derick Rethans) 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