Skip to content

ChipLog* no longer logs to stdout/stderr in darwin-framework-tool #24194

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

Closed
bzbarsky-apple opened this issue Dec 22, 2022 · 0 comments · Fixed by #24195
Closed

ChipLog* no longer logs to stdout/stderr in darwin-framework-tool #24194

bzbarsky-apple opened this issue Dec 22, 2022 · 0 comments · Fixed by #24195
Labels

Comments

@bzbarsky-apple
Copy link
Contributor

This is fallout from PR #23528.

Before that change, running something like darwin-framework-tool tests TestCluster will show these log bits:

[1671725279532] [76381:6799754] CHIP: [TOO]  **** Test Start: TestCluster
[1671725279532] [76381:6799754] CHIP: [TOO]  ***** Test Step 0 : Wait for the commissioned device to be retrieved
[1671725279532] [76381:6799755] CHIP: [TOO]  ***** Test Step 1 : Send Test Command

before it stops progress due to trying to find the server to send the server to send the command to and failing. After that change, those messages are not logged.

The problem, as far as I can tell, is that darwin-framework-tool links two copies of CHIPLogging.cpp: one as part of Matter.framework and one directly in the executable.

Which means there are two copies of sLogRedirectCallback. darwin-framework-tool sets up (indirectly, via calling MTRSetLogCallback on the framework) a log redirect that logs to stdout.

Now if we have a ChipLog* call from inside the SDK/framework it ends up in chip::Logging::Logv, it will find the framework copy of sLogRedirectCallback, that's not null, it will get called, and the output will appear on stdout.

But if we hav a ChipLog* call from directly inside darwin-framework-tool (e.g. the generated test code that logs the things above), then it will find the other copy of sLogRedirectCallback, which is null. It will then call Platform::LogV, which is a no-op on Darwin, and the log gets lost.

bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Dec 22, 2022
darwin-framework-tool ends up linking in two copies of CHIPLogging, so
the redirect we were setting up was only capturing ChipLog* calls that
happened inside Matter.framework.  The calls from
darwin-framework-tool itself were getting dropped after being logged
via os_log, and not showing up on stdout.

Also includes a drive-by fix to stop building address-resolve-tool
every time we build darwin-framework-tool.

Fixes project-chip#24194
bzbarsky-apple added a commit that referenced this issue Jan 3, 2023
…4195)

darwin-framework-tool ends up linking in two copies of CHIPLogging, so
the redirect we were setting up was only capturing ChipLog* calls that
happened inside Matter.framework.  The calls from
darwin-framework-tool itself were getting dropped after being logged
via os_log, and not showing up on stdout.

Also includes a drive-by fix to stop building address-resolve-tool
every time we build darwin-framework-tool.

Fixes #24194
kkasperczyk-no pushed a commit to kkasperczyk-no/sdk-connectedhomeip that referenced this issue Mar 15, 2023
…4195)

darwin-framework-tool ends up linking in two copies of CHIPLogging, so
the redirect we were setting up was only capturing ChipLog* calls that
happened inside Matter.framework.  The calls from
darwin-framework-tool itself were getting dropped after being logged
via os_log, and not showing up on stdout.

Also includes a drive-by fix to stop building address-resolve-tool
every time we build darwin-framework-tool.

Fixes project-chip/connectedhomeip#24194
kkasperczyk-no pushed a commit to kkasperczyk-no/sdk-connectedhomeip that referenced this issue Mar 15, 2023
…4195)

darwin-framework-tool ends up linking in two copies of CHIPLogging, so
the redirect we were setting up was only capturing ChipLog* calls that
happened inside Matter.framework.  The calls from
darwin-framework-tool itself were getting dropped after being logged
via os_log, and not showing up on stdout.

Also includes a drive-by fix to stop building address-resolve-tool
every time we build darwin-framework-tool.

Fixes project-chip/connectedhomeip#24194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant