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

OSLogWriter not working properly #381

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

robbiehanson
Copy link
Contributor

As mentioned in issue #339, the OSLogWriter doesn't work properly. In particular, it doesn't properly send messages to the OSLog system, and as such, the messages get corrupted within the OSLogStore.

It seems the source of the problem is the use of an internal API: _os_log_internal. Replacing this with a call to the public API os_log_with_type fixes the problem.

However, the standard os_log functions (the public API's that Apple tells you to use) are mysteriously missing from the kotlin-generated headers. So to get around this problem I used a cInterop file.

dpad85 added a commit to ACINQ/phoenix that referenced this pull request Feb 13, 2024
This log writer requires a patch in kermit.
See touchlab/Kermit#381 for details.

Also, the OSLog system is bugged anyway, so it should not be
used, until Apple releases a fix.
@rocketraman
Copy link
Contributor

I've tried this PR locally and I am now able to obtain logs from the oslog on an end-user device with no xcode attached via pymobiledevice3 e.g.:

pymobiledevice3 developer dvt oslog

The logs show up as <private> though, I guess because of #400.

The solution appears to be to change https://github.com/touchlab/Kermit/pull/381/files#diff-e77742a050dfd9cbf9a8cfc531a2f144dcb4c34f2b2064a2b3a3925e872d7fd3R20 to be %{public}s instead of %s.

Do you plan to rebase this PR @robbiehanson ? If not, I can take it over.

@rocketraman
Copy link
Contributor

The logs show up as though, I guess because of #400.

Update: I've installed this PR along with the change mentioned in #400 to use %{public}s and things work immensely better. I can even view the logs of an iPhone device via pymobiledevice3 syslog live from a Linux box!

Would love it if some attention was paid to this PR as well as the change suggested by the reporter of #400 . If it would help @kpgalligan I can submit an updated PR.

@KevinSchildhorn KevinSchildhorn self-requested a review November 5, 2024 16:22
@KevinSchildhorn KevinSchildhorn merged commit a38320f into touchlab:main Nov 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants