get started

The Importance of Including Logging in Your Mobile Apps

The Importance of Including Proper Logging in Your Mobile Apps

It’s 6:00am and the help desk is calling because your app has “stopped working”.

You quickly check the copy running on your phone, it works fine. You go to the dashboard you bookmarked for your cloud provider, everything looks good there.

Brewing some coffee, you get as much information from your help desk as you can about the issue, and judiciously decide to wait until 7 before trying to get your head of operations on the phone.

John, your head of operations (you remember when they were called sysadmins, but titles seem to change in the IT space faster than you can keep track), has spent more time going over your cloud services dashboard. He concludes, as you had earlier, that the backend services are up and running.

He also quickly checks the crash logs on the Google Play Store and notes that there has been an uptick in crashes over the past few hours.  “I’ve looked over the documentation for the mobile app that our dev team sent us and I don’t see any information about how to get access to the error logs – did they use Fabric or some other log reporting tool?”

“Well,” you admit sheepishly, “I didn’t even think to ask if they were going to set up error logging.”

“Hmmm…” John says, “I guess we have a problem, ‘cause I have no idea why this app is spontaneously crashing. You better see if you can get a hold of the developer and ask if they can do anything, cause we are flying blind here.”

——————————–

Adding logging to your app or software may not be on your radar; or perhaps it seems unnecessary. At Big Fish, we say it’s a must-have. Considering that you’ll be maintaining and supporting your app for years, this step will save a lot of time in the long run by revealing bugs or other issues with your software, and making them far easier for developers to find, and fix.

What Causes an App to Crash

The things that can cause an app to crash in the modern world of interconnected systems, robust applications and ever-changing operating systems, are more numerous than I can enumerate, but I will list a few:

1. Core Operating System (OS) changes

The underlying device OS receives an update due to security or a bugfix, and a feature that used to work, stops.

2. Cloud Changes

Could be a backend API change, a server OS change that updates the HTTP protocol, a DNS change or an unexpected cloud server outage.

3. Data Changes

Whether it is an unexpected date change (I hope you tested switching to and from Daylight savings, or adding a region that is on a weird time zone – I’m looking at you New Zealand with your quarter hour time zones), or a currency that was unexpected, or some new emoji being added.

It is only through extensive logging to a logging service (if you can’t get the logs easily, they aren’t very effective) that you can quickly track down bugs and unexpected behavior.

The bug may not be in the mobile app, but may require changes to the mobile app to remediate the behavior. Or, in some cases you can fix an issue in the app by modifying the response sent by the server.

Logging Services for Mobile Apps

Fortunately, there are a couple of very good and free logging services: Fabric and Firebase from Google, AppCenter from Microsoft. So, once you have added the logging code there is little expense getting the logs.

There are also paid logging services (such as Instabug and New Relic) which add more comprehensive features.

Adding a simple “catch all errors” logger is certainly better than nothing (at least then you get better crash logs than you do from the Google Play Store or App Store Connect). But, the more comprehensive the logging you add, the easier and quicker it will be to track down more complicated bugs in the future.

While you may be tempted to wait and think about adding logging after the initial app is developed, I highly recommend that you do it while the app is in development.

Developers are in a better position to remember what potential situations should be logged while developing the code. Rather than sprinkling logging in higgledy-piggledy at some later date when they have less familiarity with the structure and design of the code.

To summarize:

  • Add service-based logging (ex. Fabric, Instabug) to your mobile apps
  • Add the logging early
  • Make the logging as extensive as you can justify.

Obviously the law of diminishing returns applies in logging as it does in most things in life.

Kris @ Big Fish

Kris @ Big Fish

Kris is a software developer at Big Fish - we turn revolutionary ideas into reality through custom software design and development. Kris has over 20 years of professional software development experience. Here at Big Fish, he builds native Android and cross platform applications. In his downtime, Kris is an avid cyclist and enjoys visiting wineries with his wife.

ready to begin?