Skip to content

OSLogWriter not working properly#381

Merged
KevinSchildhorn merged 3 commits intotouchlab:mainfrom
robbiehanson:issue-339
Nov 6, 2024
Merged

OSLogWriter not working properly#381
KevinSchildhorn merged 3 commits intotouchlab:mainfrom
robbiehanson:issue-339

Conversation

@robbiehanson
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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