Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119049 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31938 invoked from network); 29 Nov 2022 11:43:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Nov 2022 11:43:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6E8D81804BE for ; Tue, 29 Nov 2022 03:43:07 -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.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Nov 2022 03:43:07 -0800 (PST) Received: by mail-ed1-f45.google.com with SMTP id r26so17275501edc.10 for ; Tue, 29 Nov 2022 03:43:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RZ2Gr4V6qtQfsiiv7XyRSWpgvy3fGJeFKJGOkBJkaSE=; b=kw51W61xe69x1/RjQ57KbRgt67hbttBuEQp0X/WO5cZe3p5YLoHBdqSh/vNF9gWL8u AmhZ7VKFOPTjHaaS1gbXtgcvbuFWCN82lC1mqTtC2zqZ3lVhC4PhyI3qHO9O3wu0Oln6 7H/VzoyizseeAbnoFgrsMGLhL4odF4xmNI6iXY0WV5EqCeIawG2ipBrPZwdu7GXYQhQR nLu97ChCrqADbCq2HHZxnb8oZXnf6pkssCbPiuTHCyNJh6qb3xX6UbK6c5Snv0E14RRT TaTrbFRtGs/+Ai5rcTKSPsEiP1DUWrbG8pEkLtqwnqbGVWesZoFrknbbNZoUgx0hLsPY nHCA== X-Gm-Message-State: ANoB5pkhjd9lm8NVRJHVhCLsOJgMa8c8/wAxNi8vMF8QP/OQAiy7rHYN YeUvfiDL6kPyZbJ6VbC9QHo5MIZJkOvUnzkpFUo= X-Google-Smtp-Source: AA0mqf4LCd4kO6x+2x93l8f9JI9niYzr2KvHPn9U5IPQPQY7UE0fHPCOgAszxeF1WgLR659iH/g9+lGVU87h4ANOFlI= X-Received: by 2002:a05:6402:1943:b0:46a:e4cd:5204 with SMTP id f3-20020a056402194300b0046ae4cd5204mr2041905edz.402.1669722185664; Tue, 29 Nov 2022 03:43:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 29 Nov 2022 11:42:54 +0000 Message-ID: To: Derick Rethans Cc: Mikhail Galanin , internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000c00eeb05ee9a7dad" Subject: Re: [PHP-DEV] Microseconds to error log From: bukka@php.net (Jakub Zelenka) --000000000000c00eeb05ee9a7dad Content-Type: text/plain; charset="UTF-8" On Mon, Nov 28, 2022 at 4:13 PM Derick Rethans wrote: > On Fri, 21 Oct 2022, Mikhail Galanin via internals wrote: > > 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. > > I'm not sure I understand this because error_log itself is already configurable using INI so obviously if the file path is specified there, then the logged time format should be the same if configured in ini. By default there is no error log so errors that happen before should not be logged anyway. Or do I miss anything? > > 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 > > It is not always practical to use system log for PHP especially for users using more than one FPM pool. Log files also offer some advantages like easier export and post processing so I think there is still place for log files and we should support the users that still use them which includes new features like this one. Cheers Jakub --000000000000c00eeb05ee9a7dad--