12

Summary

I have been having problems accessing the K9 log messages using aLogcat, see below for more details. What I would like to know is:

  • Why are no log messages from K9 appearing in the aLogcat log viewer?
  • Does anyone have any suggestions as to how I can see the full text of the errors which are occurring when trying to sync my K9 folders?
  • Could something have changed in Jelly Bean which lead K9's logging to stop working?
  • Since there seem to be remarkably few messages being shown by aLogcat in general, has something has changed in Jelly Bean which could mean that it is no longer able to access all messages?

Detail

I have recently been having connection problems with K9. My folders fail to sync and the folder list ends up full of socket errors (libcore.io.ErrnoException:) or ssl errors (javex.net.ssl.SSLException:) etc. where the last checked time should be. I get different messages depending on which problem is occurring at the time, but I can't see the full text of the error message, so it's difficult to guess what the cause might be.

Thinking that the log files might contain more information, I followed the instructions at Recording a debug log, enabled debug logging in K9, installed aLogcat and tried to look at the logs. Sadly, whichever log buffer I select (Main, Events or Radio), there appear to be no messages from K9.

If I add the suggested (k9|AndroidRuntime) regex filter then I see nothing in any of the logs. If I remove it then Main contains mostly garbage collection messages, Events seem to contain mostly messages from aLogcat itself and I haven't seen a log message in Radio yet.

If it makes any difference, I'm using a Nexus 7, but I would have thought that logging would have been to a standard location which wouldn't change between android versions.

2 Answers 2

25

Does anyone have any suggestions as to how I can see the full text of the errors which are occurring when trying to sync my K9 folders?

It seems that there is no way to see these log messages on the device without root access, but if you do have root access, there are a couple of options, either grant the required permissions to aLogcat or consider using a horrible hackTM to view them directly.

View the log files on your PC or workstation via adb

If you can connect your Android device to a PC or workstation, then you can access the logs via the adb command.

To do this on Windows, first you will need to install the Android SDK (which will require the Java SE SDK) and add the android-sdk\tools and android-sdk\platform-tools to the system path. Then enable USB debugging on your Nexus 7, plug it in via USB, and install the Android Composite ADB Interface from android-sdk\extras\google\usb_driver (I had to force Windows XP to look here, it wouldn't find the drivers on it's own).

For details of how to get adb up and running without the full Android SDK install, or on Mac or Linux machines, see Izzy's excellent answer to Is there a minimal installation of ADB?

Then you can open a shell (i.e. a cmd window) and run the command:

adb logcat k9:V *:S AndroidRuntime:E
  • I have confirmed that this works on my non-rooted Nexus 7.

Grant permissions to aLogcat

If you have root access, you could consider granting the READ_LOGS permission to aLogcat, as suggested in this post aLogcat/CatLog/Lumberjack not working? Do this ... on the xda-developers forum:

pm grant <pkg> android.permission.READ_LOGS

To grant this permission to alogcat or alogcat.donate, you would use one of the following commands, depending on whether you are running the donate version or not:

pm grant org.jtb.alogcat.donate android.permission.READ_LOGS
pm grant org.jtb.alogcat android.permission.READ_LOGS

According to one post on android-developers and the ticket, the permission grant survives reboot and update, but not uninstall/reinstall.

Sadly since this requires root access, whether I run this on the device or on my PC (prefixed by adb shell) I just get the error:

Neither user 12345 nor current process has android.permission.GRANT_REVOKE_PERMISSION
  • I cannot confirm that this works, since my Nexus 7 has not been rooted.

Consider using a horrible hackTM

If you have root access, you could consider making logcat setuid root and running logcat from the device shell, as suggested in this answer to my How can I access android log files on my Nexus 7 without root access?question:

chmod 04755 /system/bin/logcat
logcat k9:V *:S AndroidRuntime:E
  • Again, I cannot confirm that this works and I would probably only use it as a last resort, given the security implications.

Why are no log messages from K9 appearing in the aLogcat log viewer?

Could something have changed in Jelly Bean which lead K9's logging to stop working?

Since there seem to be remarkably few messages being shown by aLogcat in general, has something has changed in Jelly Bean which could mean that it is no longer able to access all messages?

This appears to be a change in Jelly Bean which affects all applications which may try to read the log files.

Apparently READ_LOGS permission is not granted to 3rd party applications in Jelly Bean. Since this link seems to be unreliable:

Today I've tested my application on newest (api 16) emulator before releasing it to Google Play. It turned out that Android now refuses to grant this permission to 3rd party applications. This is weird because I've looked through all Jelly Bean's documented changes and couldn't find anything that mentions READ_LOGS permission.

and later

The protectionLevel for READ_LOGS is now "signature|system|development". The new pipe syntax for protectionLevel is also undocumented (see http://code.google.com/p/android/issues/detail?id=34785).

My suspicion is that aLogcat is only seeing messages generated by itself and it's vm.

For further information, see Flow answer's to my question How active should I expect my Jelly Bean system log file to be?

11
  • IIRC adb logcat is still able to get the full android log on Jelly Bean.
    – Flow
    Sep 6, 2012 at 9:32
  • It does not require root but you need to enable adb on your device (usually under developer options).
    – Flow
    Sep 6, 2012 at 10:16
  • @Flow - I've now confirmed that I can view the log on my PC using adb logcat from there and have updated my answer accordingly. It's still frustrating that I can't find any way to access the logs without root access from the device itself.
    – Mark Booth
    Sep 9, 2012 at 1:35
  • It is the whole point in the JB log change that a non-root user can't access the full system log.
    – Flow
    Dec 30, 2012 at 13:25
  • @Flow - Yeah, and the whole point of log messages is that you can use them to find out what's going on. JB makes an app like aLogcat pretty pointless, since it can now only access log messages it has created itself!
    – Mark Booth
    Dec 31, 2012 at 19:12
0

I've seen this behaviour in K9 when my mail server updated it's SSL certificates. The fix was to long-press the account, select Account settings -> Fetching mail -> Incoming server and just hit Next through the pages to confirm your settings until you get the popup about the certificate (this might not appear if everything is OK with the certificate, mine had a wrong vhost). Confirm the certificate and just go through the rest of the settings and you account should start to work.

5
  • @MarkBooth Perhaps you should have asked that, we generally prefer questions that don't presuppose a solution. Aug 28, 2012 at 17:42
  • @MatthewRead I must agree with Mark here: The 4 items in his summary explicitly state he wants help with the logging issue, and I also do not see the "XY problem" here (presupposed solution). K9 is clearly just the example -- but maybe the question title should be adjusted to underline it: "Using logcat to determine the cause of problems" would match (and focus) better ;)
    – Izzy
    Sep 5, 2012 at 15:27
  • @MarkBooth Yepp, tnx -- much clearer now. Also tnx for the detailed answer! Please keep us updated about your progress.
    – Izzy
    Sep 6, 2012 at 10:48
  • Should I delete my answer, since it's completely off-topic after the edits and prone to be downvoted?
    – onik
    Sep 6, 2012 at 11:25
  • It's up to you onik. As I said originally I do appreciate you taking the time to post an answer, but now that I've updated the question your answer looks even more out of place. I suppose you could always wait and see if it gets voted below -3 so you can collect your peer pressure badge. *8')
    – Mark Booth
    Sep 6, 2012 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .