-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
not writting files android 11 #228
Comments
Hi, thanks for replying, the reason to write outside the app specific directory is to the end user to have the log at hand, because they dont have a lot of knowledge and start digging in directories is a risk.
The steps to reproduce the issue are the following:
1.- use android 11
2.- dont use MANAGE_EXTERNAL_STORAGE permission
3.- use MANAGE_DOCUMENTS permission and MANAGE_INTERNAL_STORAGE permission
4.- configure logbak at /storage/emulated/0/documents/logs directory
5.- start the app and start logging
6.- delete de log file at /storage/emulated/0/documents/logs directory
7.- try to log again, the file doesnt write again
…________________________________
De: Tony Trinh ***@***.***>
Enviado: sábado, 6 de noviembre de 2021 09:49 p. m.
Para: tony19/logback-android ***@***.***>
CC: sagamagus ***@***.***>; Author ***@***.***>
Asunto: Re: [tony19/logback-android] not writting files android 11 (#228)
The description is very unclear. Can you clarify with exact reproduction steps? Or a link to a reproduction? Also I can't reproduce the "write once" problem in the emulator.
Note MANAGE_EXTERNAL_STORAGE is only needed to write files outside of the app-specific directory in external storage. Is there a particular reason you want to write to /storage/emulated/0/documents/logs instead of the app-specific directory?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#228 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVIF6THD5LVMGBV62EJPKY3UKYAMBANCNFSM5C57VE7A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Notes on permission usage:
|
It sounds like there are two issues here:
|
Yes, the
1.- the final user is a little cocky, if i put it ond downloads he will say "but i didnt downloaded anything" or something like that, originally before android 11 we write the log directly on root on a log directory
2.- even if the app is closed, once you delete the file it doesn't write anymore
…________________________________
De: Tony Trinh ***@***.***>
Enviado: martes, 9 de noviembre de 2021 05:45 p. m.
Para: tony19/logback-android ***@***.***>
CC: sagamagus ***@***.***>; Author ***@***.***>
Asunto: Re: [tony19/logback-android] not writting files android 11 (#228)
It sounds like there are two issues here:
1. You want to write logs to shared storage on Android 11. It's not clear to me whether you actually need the location to be the Documents folder. If the objective is for users to be able to pull the logs themselves from a commonly accessible directly, you could use the Downloads folder, which does not require any special permissions.
2. You delete the log file while the app is running, and you want the logger to create a new log file the next time it tries to log something, but it doesn't? Is that right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#228 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVIF6TAJS2UJQDDE42VLKD3ULGXC7ANCNFSM5C57VE7A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I saw the same issue, and I see the following error:
I started to debug the issue and added the following code to my Application
With that code
(Doesn't need any permissions on Android 4.4+) |
Description
there is an issue involving Android 11 and the google policy that dont let upload to playstore with the permission "MANAGE_EXTERNAL_STORAGE", if you dont use that permission the logs write once, but if you have another app in background, doesnt writte nor the file, nor the logs once the files exists, and if you delete the log file, it doent write again a file with that name, you must change the name of the file.
Steps to reproduce
logback.xml:
<configuration>
<timestamp key="bySecond" datePattern="yyyyMMdd"/>
<property name="LOG_DIR" value="/storage/emulated/0/documents/logs" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOG_DIR}/log-${bySecond}.txt</file>
<append>true</append>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{40} - %msg%n</pattern>
</encoder>
</appender>
</configuration>
add this to manifest to write in Documents route:
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
Environment
logback-android
version: 2.0.0The text was updated successfully, but these errors were encountered: