AAA - Andsens Android Applications


aLogViewer

I wrote aLogViewer as I realized that I, after a very unfortunately update of my HP41 simulator a41 - both for the users and the apps rating, need users to do a little testing prior to releasing new versions on Market.

As I can't expect users to be developers I needed an easy method for users to grab the log and hopefully only the interesting part of the log. Using aLogViewer allows you to add two filter to the log. One where you specify a tag to filter for and the level of messages to let through and a level of which other messages are let through.

The following levels are possible:

  • V — Verbose (lowest priority)
  • D — Debug
  • I — Info
  • W — Warning
  • E — Error
  • F — Fatal
  • S — Silent (highest priority, on which nothing is ever printed)

The lag are extracted using the following command:

  • logcat -d -v long tag:l1 *:l2

where l1 is the level of tag you are examining and l2 is the level of the other messages you want included in the log listing.

The first version was released on Android Market on November 14 2011.

News

  • 4. March 2012 - Version 1.1 released on Google Market This version includes the following enhancements:
    1. Can now be called from other apps and open mail with log and phone informations
    2. Now also radio and events logs can be displayed
    3. You can filer for multiple tags by separating them with | (well, you could that in version 1.0 but i hadn't figured it out)
    4. You can retrieve the log unformatted
    5. More robust algorithm for formatting the output
    6. Log view are now updated automatic after a "Clear log"
    7. Bug fixes
  • November 2011 - Version 1.0 released on Google Market This version includes the following functionality:
    1. First version of aLogViewer
    2. Log entries can be filtered by tag and level
    3. Log entries where level equal or higher than threshold can be let through the filter
    4. Log entries can be coloured according to their log level
    5. Colour of the different log levels are configurable
    6. Show information about phone and operating system
    7. Copy content of current view to clip board

Currently aLogViewer is translated to English and Danish (other translations are welcome).

How to use aLogViewer from other apps

Add the following function to your code

01   /**
02    * If logging turned on and user want to send error logs open
03    * aLogViewer and prepare mail
04    @param errMsg
05    */
06   private void getLog(String errMsg) {
07     if (_logging && _sendErrLogs) {
08       // write error message to the log
09       Utils.logE(errMsg, _logging);
10       PackageManager pm = getPackageManager();
11       try {
12         String packageName = "dk.andsen.ALogViewer";
13         Intent i = pm.getLaunchIntentForPackage(packageName);
14         if (i == null) {
15           Utils.logD("aLogViewer not found", _logging);
16         else {
17           i.putExtra("Filter""FieldWork");
18           i.putExtra("Level""D");
19           i.putExtra("Mail""your@email.com");
20           startActivity(i);
21         }
22       catch (Exception e) {
23         Utils.logE("Error loading aLogViewer" + e.getLocalizedMessage() , _logging);
24       }
25     }
26   }

In line 17 change "FieldWork" to log tag for your app and change the email in line 19 to your own.

Call it like where you catch exception:

1   catch (Exception e) {
2     Utils.logD("Problems during initialise", _logging);
3     e.printStackTrace();
4     getLog(e.getLocalizedMessage());
5   }

aLogViewer screen dumps!

The following screen dumps shows what is possible with the aLogViewer. Click on a image to see it in full size.

Implemented functionality

The following functionality has been implemented in the aLogViewer (with indication of from which version the functionality was introduced):

  1. Log entries can be filtered by tag and level (1.0)
  2. Log entries where level equal or higher than threshold can be let through the filter (1.0)
  3. Log entries can be coloured according to their log level (1.0)
  4. Colour of the different log levels are configurable (1.0)
  5. Show information about phone and operating system (1.0)
  6. Copy content of current view to clip board (1.0)
  7. Log view are now updated automatic after a "Clear log" (1.1)
  8. More robust algorithm for formatting the output (1.1)
  9. You can retrieve the log unformatted (1.1)
  10. You can filer for multiple tags by separating them with | (well, you could that in version 1.0 but i hadn't figured it out) (1.1)
  11. Now also radio and events logs can be displayed (1.1)
  12. Can now be called from other apps and open mail with log and phone informations (1.1)

Idea's for the next version:

  1. ???

Any wishes for coming versions of aLogViewer? Drop me a mail!


QR Code Android

This Andsen page was last updated in March 2012