Skip to content
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

Fix log output #1014

Merged
merged 2 commits into from May 19, 2022
Merged

Fix log output #1014

merged 2 commits into from May 19, 2022

Conversation

hannaeko
Copy link
Member

@hannaeko hannaeko commented May 18, 2022

Purpose

Fixes log messages not being redirected to log file when using starman.

Context

fixes #1013

Changes

  • Don't duplicate the STDERR so log message are correctly redirected.
  • Changes the default log level to info so that the default log level in RPCAPI is the same as the one in agent.
  • Imports missing dependency.

How to test this PR

Start the RPCAPI:

unset ZM_BACKEND_RPCAPI_LOGLEVEL
starman --preload-app --error-log=/tmp/zm-rpcapi.log --pid=/tmp/zm-rpcapi.pid --listen=127.0.0.1:5000  script/zonemaster_backend_rpcapi.psgi

In another terminal start a new test:

./script/zmb start_domain_test --domain zonemaster.net

Only the pre-fork log messages should be displayed in STDERR:

2022-05-18T10:43:06Z [52630] [NOTICE] [Zonemaster::Backend::Config] Loading config: /tmp/zonemaster/backend_config.ini
2022-05-18T10:43:06Z [52630] [INFO] [Plack::Sandbox::_2fhome_2fgbm_2fworkspace_2fzonemaster_2fzonemaster_2dbackend_2fscript_2fzonemaster_backend_rpcapi_2epsgi] Enabling add_api_user method
2022-05-18T10:43:06Z [52630] [INFO] [Plack::Sandbox::_2fhome_2fgbm_2fworkspace_2fzonemaster_2fzonemaster_2dbackend_2fscript_2fzonemaster_backend_rpcapi_2epsgi] Enabling add_batch_job method

The file /tmp/zm-rpcapi.log should contain a line indicating the DB connection:

2022/05/18-12:39:12 Starman::Server (type Net::Server::PreFork) starting! pid(51380)
Binding to TCP port 5000 on host 127.0.0.1 with IPv4
Setting gid to "1000 1000 3 90 98 963 966 991 998 1000"
2022-05-18T10:39:15Z [51381] [NOTICE] [Zonemaster::Backend::DB] Connecting to database 'DBI:Pg:dbname=travis_zonemaster;host=10.10.86.42;port=5432' as user 'travis_zonemaster' Extra parameters: {'rpc_method' => 'start_domain_test'}

@hannaeko hannaeko added the T-Bug Type: Bug in software or error in test case description label May 18, 2022
@hannaeko hannaeko added this to the v2022.1 milestone May 18, 2022
@hannaeko hannaeko requested review from mattias-p, matsduf and a user May 18, 2022 10:51
@hannaeko hannaeko linked an issue May 18, 2022 that may be closed by this pull request
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as expected

Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks fine, but I will test tomorrow, even if already merged.

Copy link
Member

@mattias-p mattias-p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannaeko hannaeko merged commit 04b9285 into zonemaster:develop May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Bug Type: Bug in software or error in test case description
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPC API log messages go to STDERR, not to log file
3 participants