Cannot enable verbose logs



  • I'm encountering synching problems with my ownCloud server. So I'm trying to enable verbose logs.

    But when I enable the option "log to external storage", I get an error. In french the notification is: "impossible de créer le fichier journal externe" which should correspond in english to "cannot create external log file".

    I bought the DAVdroid app from the Play Store. My phone is a Nexus 5 running Cyanogenmod CM13 nightlies.

    Is it a known issue ?

    What can I do to help ?
    Thanks


  • developer

    @mattieu Is there an external storage with enough free space on your device? Unfortunately, the reason why logs couldn't be created is only logged using adb. You can use adb logcat to view adb logs.



  • Yes, I have enough storage. It seems to be an access permission problem:

    08-24 14:36:04.500 25249 25249 I davdroid: [App] Logging to /storage/emulated/0/Android/data/at.bitfire.davdroid/files/davdroid-25249-20160824-143604.txt
    08-24 14:36:04.502 25249 25249 E davdroid: [App] Couldn't create external log file
    08-24 14:36:04.502 25249 25249 E davdroid: EXCEPTION java.io.FileNotFoundException: /storage/emulated/0/Android/data/at.bitfire.davdroid/files/davdroid-25249-20160824-143604.txt.lck: open failed: EACCES (Permission denied)
    08-24 14:36:04.502 25249 25249 E davdroid:      at libcore.io.IoBridge.open(IoBridge.java:452)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.util.logging.FileHandler.initOutputFiles(FileHandler.java:189)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.util.logging.FileHandler.init(FileHandler.java:159)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.util.logging.FileHandler.<init>(FileHandler.java:386)
    08-24 14:36:04.502 25249 25249 E davdroid:      at at.bitfire.davdroid.App.reinitLogger(App.java:119)
    08-24 14:36:04.502 25249 25249 E davdroid:      at at.bitfire.davdroid.ui.AppSettingsActivity$SettingsFragment.setExternalLogging(AppSettingsActivity.java:106)
    08-24 14:36:04.502 25249 25249 E davdroid:      at at.bitfire.davdroid.ui.AppSettingsActivity$SettingsFragment.onPreferenceTreeClick(AppSettingsActivity.java:69)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.support.v7.preference.Preference.performClick(Preference.java:981)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.support.v7.preference.Preference.performClick(Preference.java:957)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.support.v7.preference.SwitchPreferenceCompat.performClick(SwitchPreferenceCompat.java:203)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.support.v7.preference.Preference$1.onClick(Preference.java:145)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.view.View.performClick(View.java:5204)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.view.View$PerformClick.run(View.java:21158)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.os.Handler.handleCallback(Handler.java:739)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.os.Handler.dispatchMessage(Handler.java:95)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.os.Looper.loop(Looper.java:148)
    08-24 14:36:04.502 25249 25249 E davdroid:      at android.app.ActivityThread.main(ActivityThread.java:5461)
    08-24 14:36:04.502 25249 25249 E davdroid:      at java.lang.reflect.Method.invoke(Native Method)
    08-24 14:36:04.502 25249 25249 E davdroid:      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    08-24 14:36:04.502 25249 25249 E davdroid:      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    08-24 14:36:04.502 25249 25249 E davdroid: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
    08-24 14:36:04.502 25249 25249 E davdroid:      at libcore.io.Posix.open(NativeMethod)
    08-24 14:36:04.502 25249 25249 E davdroid:      at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
    08-24 14:36:04.502 25249 25249 E davdroid:      at libcore.io.IoBridge.open(IoBridge.java:438)
    08-24 14:36:04.502 25249 25249 E davdroid:      ... 22 more
    08-24 14:36:04.520 25342 25342 I davdroid: [App$ReinitLoggingReceiver] Receivedbroadcast: re-initializing logger
    08-24 14:36:04.561 25342 25342 I davdroid: [App] Logging to /storage/emulated/0/Android/data/at.bitfire.davdroid/files/davdroid-25342-20160824-143604.txt
    08-24 14:36:04.563 25342 25342 E davdroid: [App] Couldn't create external log file
    08-24 14:36:04.563 25342 25342 E davdroid: EXCEPTION java.io.FileNotFoundException: /storage/emulated/0/Android/data/at.bitfire.davdroid/files/davdroid-25342-20160824-143604.txt.lck: open failed: EACCES (Permission denied)
    08-24 14:36:04.563 25342 25342 E davdroid:      at libcore.io.IoBridge.open(IoBridge.java:452)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.util.logging.FileHandler.initOutputFiles(FileHandler.java:189)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.util.logging.FileHandler.init(FileHandler.java:159)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.util.logging.FileHandler.<init>(FileHandler.java:386)
    08-24 14:36:04.563 25342 25342 E davdroid:      at at.bitfire.davdroid.App.reinitLogger(App.java:119)
    08-24 14:36:04.563 25342 25342 E davdroid:      at at.bitfire.davdroid.App$ReinitLoggingReceiver.onReceive(App.java:164)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.app.ActivityThread.handleReceiver(ActivityThread.java:2759)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.app.ActivityThread.-wrap14(ActivityThread.java)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.os.Handler.dispatchMessage(Handler.java:102)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.os.Looper.loop(Looper.java:148)
    08-24 14:36:04.563 25342 25342 E davdroid:      at android.app.ActivityThread.main(ActivityThread.java:5461)
    08-24 14:36:04.563 25342 25342 E davdroid:      at java.lang.reflect.Method.invoke(Native Method)
    08-24 14:36:04.563 25342 25342 E davdroid:      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    08-24 14:36:04.563 25342 25342 E davdroid:      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    08-24 14:36:04.563 25342 25342 E davdroid: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
    08-24 14:36:04.563 25342 25342 E davdroid:      at libcore.io.Posix.open(NativeMethod)
    08-24 14:36:04.563 25342 25342 E davdroid:      at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
    08-24 14:36:04.563 25342 25342 E davdroid:      at libcore.io.IoBridge.open(IoBridge.java:438)
    08-24 14:36:04.563 25342 25342 E davdroid:      ... 17 more
    

  • developer

    @mattieu said in Cannot enable verbose logs:

    /storage/emulated/0/Android/data/at.bitfire.davdroid/files/davdroid-25249-20160824-143604.txt

    should always be accessible by DAVdroid. Can you imagine why it is not? Do you use any special things (Ext4 for external storage etc.)?



  • I can't think of anything special on the device. It's a standard Cyanogenmod release, nothing is customized.
    Could it be related to the new permission model on Android 6.0 ?

    I've also seen various problems with accessing external storage from android applications throughout the web. It seems starting with Android 4.4, applications needs to request write access to external storage.

    With adb, connected as a simple user, I can't access the storage:

    ····shell@hammerheadcaf:/ $ id
    ····uid=2000(shell) gid=2000(shell) ····groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)context=u:r:shell:s0
    ····shell@hammerheadcaf:/ $ ls -alFh /storage/emulated/0
    ····ls: .: Permission denied
    

  • developer

    @mattieu said:

    Could it be related to the new permission model on Android 6.0 ?

    No, DAVdroid is ready for Android 6 and later. External logging works here with CM 13.0.

    I've also seen various problems with accessing external storage from android applications throughout the web. It seems starting with Android 4.4, applications needs to request write access to external storage.

    Since Android 4.4, READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE are not required to access only files that are private to your app. DAVdroid uses getExternalFilesDir as recommended, and the directory /storage/emulated/0/Android/data/at.bitfire.davdroid/files/ looks right for me.

    In my opinion, DAVdroid should have access to its app-private directory /storage/emulated/0/Android/data/at.bitfire.davdroid/files/.

    With adb, connected as a simple user, I can't access the storage:

    ····shell@hammerheadcaf:/ $ id
    ····uid=2000(shell) gid=2000(shell) ····groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)context=u:r:shell:s0
    ····shell@hammerheadcaf:/ $ ls -alFh /storage/emulated/0
    ····ls: .: Permission denied
    

    Sounds strange for me, too. I guess there's something wrong with your external storage permissions (maybe something like that). Can you use external storage from other apps without problems?


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.