Skip to content

Let php-fpm -tt dump info regardless of log_level #13256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: PHP-8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sapi/fpm/fpm/fpm_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,12 @@ static void fpm_conf_dump(void)
{
struct fpm_worker_pool_s *wp;

// set level to at least NOTICE, so that the following output is visible regardless of configured log_level
int old_level = zlog_set_level(ZLOG_NOTICE);
if (old_level < ZLOG_NOTICE) {
zlog_set_level(old_level);
}

/*
* Please keep the same order as in fpm_conf.h and in php-fpm.conf.in
*/
Expand Down Expand Up @@ -1815,6 +1821,8 @@ static void fpm_conf_dump(void)
}
zlog(ZLOG_NOTICE, " ");
}
// reset level
zlog_set_level(old_level);
}

int fpm_conf_init_main(int test_conf, int force_daemon) /* {{{ */
Expand Down
38 changes: 38 additions & 0 deletions sapi/fpm/tests/config-dump-log-level.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--TEST--
FPM: -tt dumps config as NOTICEs regardless of log level
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php

require_once "tester.inc";

$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
log_level = warning
pid = {{FILE:PID}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 5
php_admin_flag[log_errors] = 1
EOT;

$tester = new FPM\Tester($cfg);
$tester->start(['-tt']);
$tester->expectLogConfigOptions([
'log_level = WARNING',
'php_admin_value[log_errors] = 1',
]);
// $tester->expectLogNotice('configuration file %s test is successful', null, 1, true, true);

?>
Done
--EXPECT--
Done
--CLEAN--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>