HyperLog: Android Remote Logger Library for Debugging.
HyperLog A utility logger library for Android on top of standard Android Log class for debugging purpose.
It’s not easy to debug live mobile apps or library, or create every possible environment in which your end users use your app, given the variety of Android devices and variety of Android versions. It’s very difficult to replicate every possible configuration and reproduce every single bug that could possibly occur when millions of users use your app. During mobile app development, we often find that logcat (for debugging) in Android Studio gets clear when an app reinstalls. However, this isn’t a good approach as you are going to be get lots of log statement in your logcat and logcat doesn’t maintain a history. Logging across multiple testing devices is hard.
Mobile developers are mostly familiar with tools such as Google Analytics or Fabric.io but they are analytics or crashlytics systems, but not fully fledged logging solutions. Remote logging can be used to debug issues in both development and production. It makes debugging a much simpler and smoother process.
At HyperTrack, logs are the medium through which HyperTrack SDK speaks with us. It gives us end-to-end visibility. It helps us to debug issues while developer/user, who is using the HyperTrack SDK, sits on the other side of the world. HyperTrack SDK pushes log to the HyperTrack server, and the HyperTrack server uses ELK stack to process the logs and visualize them on Kibana. We have discussed our logging approach in more detail in an earlier blog.
There are many Logger libraries available for developers, e.g., Android-Logger and Timber. But these libraries print logs message on logcat in Android Studio that doesn’t help to get the behaviour of app in production, which means that these logs message aren’t accessible to the developers. Remote logging is the solution that helps to debug the problem. Remote logging the right set of information could provide valuable information that would be difficult to gather otherwise, and could help unveil unexpected behaviours and bugs. Remote Logging increases accountability and gives you confidence. When someone has experienced a use-case that you haven’t thought of, saying “We will investigate” is not great accountability. Saying “We have the logs and we know the exact line of code where the error occurred” is accountability.
Introducing HyperLog
HyperLog is a utility logger library for Android on top of standard Android Log class for debugging purpose. This is a simple library that will allow Android apps or library to store log message into the database so that developer can pull the logs from the database into the file or push the logs to your server for debugging from the database as a file. The Demo App will help you see the library in action.
Download
The library is available on mavenCentral() and jcenter(). In your app level build.gradle, add the following code snippet and run the gradle-sync. You can alternatively follow the steps as highlighted here.
Once this is done, you can start recording logs message and smartly push them to your server for debugging.
Initialize and Usage
Inside `onCreate` of Application class or Launcher Activity initialize the library.
Push Logs to the Server
Developers can push logs to their server whenever they want. They can achieve this by multiple ways such as by pushing an FCM Notification to their app and when notification received then call HyperLog.pushLogs or by creating a scheduled job and when job scheduled then call HyperLog.pushLogs that will push a text file or gzip compressed file to your remote-server.
Set the API Endpoint URL HyperLog.setURL before calling HyperLog.pushLogs method otherwise exception will be thrown.
Have issues or feature requests? Use issues tracker. We’d love to see your pull requests, so send them in! Have questions, suggestions? Join the discussion on slack.
Like what we are doing? Sign up to HyperTrack and use building blocks for your location features!
Happy Downloading