AndroidPub
Published in

AndroidPub

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

--

--

--

The (retired) Pub(lication) for Android & Tech, focused on Development

Recommended from Medium

Tackling fork 5 at a network level using gossip correction (part 1/2)

Cloud Security: Protect your Cloud-First Approach from the Wind, the Hail, and the Rain brewing…

NBA Season Lines Project Blog

A Taste of MySQL in C

Reverse Engineering Mobile Games:  ZOOKEEPER BATTLE Quest Network

from fit6 http://ift.tt/2k5vKC8 via alanafalk.jimdo.com

Advent of Code 2021 with Rust — Day 5

[PDF] D.O.W.N.L.O.A.D OpenShift in Action Full-Online

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aman Jain

Aman Jain

SDE @Nvidia | Kubernetes | Prometheus | Android

More from Medium

Handling project dependencies using type-safe project accessor

Watch files on folder with Kotlin

Start Your New Android Project with Java. But Why?

How To Use The Google Play Voided Purchases API With Spring Boot — Part 2/2