restcomm-android-sdk icon indicating copy to clipboard operation
restcomm-android-sdk copied to clipboard

Enhance JAIN SIP logs so that they show up together with SDK logs in logcat

Open atsakiridis opened this issue 8 years ago • 1 comments

Right now the user needs to tell RCDevice to enable logs (by DEBUG_JAIN_SIP_LOGGING_ENABLED) and then logs in DEBUG level are output to a file in the Android Device which is pretty difficult to use.

Instead, also consider making JAIN SIP logs adhere to RCLogger logic (or similar), so that SDK user just needs to decide what level of logging they want and then all SDK code (including JAIN SIP) should take a hint from that.

Also check if we can do something similar to that for WebRTC logs

atsakiridis avatar Jul 18 '17 10:07 atsakiridis

A couple of additional notes after working on another issue related with jain-sip.ext: Leaving log4j with no configuration and then calling BasicConfigurator.configure() that adds some very basic configuration has the result of the logs showing up in Android logcat as:

09-29 11:06:07.824 30754-30815/org.restcomm.android.olympus I/System.out: 1014 [signaling-handler-thread] DEBUG android.org.mobicents.ext.javax.sip.dns.DefaultDNSServerLocator  - Resolving staging.restcomm.com transport TLS
09-29 11:06:08.047 30754-30815/org.restcomm.android.olympus I/System.out: 1236 [signaling-handler-thread] INFO android.org.mobicents.ext.javax.sip.dns.DefaultDNSLookupPerformer  - ---- Using timeout: 1

Which is a good start, but still would be nice to show a little bit more like Android logs and:

  • The level/severity shows up properly; right now all show up as I/System.out, even the DEBUG ones, while they should show up as D/System.out
  • Instead of System.out they should show the related module

Also an issue I found both in jain-sip and jain-sip.ext is that some logs use the stack logger (i.e. CommonLogger.java) which is a wrapper over log4j, and others use log4j directly (which I believe it's not configured at all, hence the need to call BasicConfigurator.configure()). So would be nice if we could unify the logging facilities for both jain-sip and jain-sip.ext, and also make them play nicer with Android, and all without messing with other users of these libs, like SipServlets.

Ultimately we don't want jain-related logs in Android to be written in file (unless explicitly requested of course), but in Android logcat and show up consistently with all other logs. Also if the user requests that the logs be written into file, it should apply to all logs not just the ones happening from the stack logger

atsakiridis avatar Sep 29 '17 13:09 atsakiridis