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
Do *not* truncate tags over 23 characters #350
Comments
I just combed through AOSP API 25 and the check is still in place. The documentation for |
This behavior already exists: timber/timber/src/main/java/timber/log/Timber.java Lines 586 to 589 in 84b1576
|
You missed the point. isLoggable isn't safe. Actual logging is. And the second point, it isn't safe up until and including API 25. The documentation is wrong. |
We don't call that API. |
Ok, in which case we don't have to truncate the tags at all. The only thing that throws is Plus the new I probably should draft a sample project. |
The struct sent to the kernel only had 23 bytes until API 24
…On Mon, Feb 18, 2019, 9:13 AM Eugen Pechanec ***@***.*** wrote:
Ok, in which case we don't have to truncate the tags at all. The only
thing that throws is Log.isLoggable below API *26*. Again, the actual
logging doesn't care about tag length (according to AOSP).
Plus the new LogcatTree.withCompliantLogging() does call Log.isLoggable.
I probably should draft a sample project.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#350 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEYBvampeA24OY6JuDPrkcQ__wft-ks5vOrUjgaJpZM4bAbtw>
.
|
Admittedly, C is not my forte... Anyway, how is it then possible that logging with tags over 23 characters just works everywhere I tried? I took a Huawei ALE-L21 with Android 6, whipped out a Samsung Galaxy SII running Android 4.1, and unearthed a HTC Vision with a dusty Gingerbread. All of them log just fine, until I call And on the other side we have my old Xperia L with an unofficial Android 7.1 that throws Here's the sample project: https://github.com/consp1racy/android-test-loggable Here's a sample input:
Here's a sample output:
Bottom line:
Another logging library has observed the same thing: https://jira.qos.ch/browse/SLF4J-164 I wouldn't even know that too long tags was a thing until one day Timber just started truncating them out of the blue. Everything worked fine.
Why does it still work? It prints the tag from unallocated memory until it encounters a \0? What's happening there? 23 bytes isn't even 23 wide characters. |
I don't see a reason to bother with changing this. The limitation is removed on new API levels and the restriction was widely understood to exist prior to that. Whether it actually is enforced and where is an implementation detail and I don't want to mess with it. |
Quoting my comment #196 (comment)
Source:
Going forward
LogcatTree
couldwithCompliantLogging()
is used.The text was updated successfully, but these errors were encountered: