CatLog now supports external Intents

As of version 1.3.2, you can now start up the main CatLog activity using an external Intent, with parameters for filter text and log level.

For Android developers, the idea is that you can just put a switch in your app where, if some debug variable is enabled, you can press a button or access a menu item to start up CatLog and search for text related to your app. This should make it less painful to do debugging, in situations where you don’t have access to adb logcat.

I’ve written a simple demo app on GitHub to show how to use the new Intent.  But the basic gist is that you want to paste something like this into your code:

Intent intent = new Intent("com.nolanlawson.logcat.intents.LAUNCH");

intent.putExtra("filter", myFilterText);
intent.putExtra("level", myLevelText);

startActivity(intent);

That’s it! Full documentation is below.

Intent

com.nolanlawson.logcat.intents.LAUNCH

Parameters

filter

Text to filter by.  Case doesn’t matter, and you can search for either process ids, tags, or log text.

level

Log level to set CatLog to, case insensitive.  One of:

  • E (error)
  • W (warn)
  • I (info)
  • D (debug)
  • V (verbose)
  • F (what a terrible failure)

11 responses to this post.

  1. Posted by curly on January 30, 2012 at 6:00 PM

    cool. How about automating the process of collecting and emailing logs? An intent to start and one to stop with the log then emailed?

    Reply

    • Hmmm… that sounds like an interesting idea, but it also opens up a security hole. Apps without the READ_LOGS permission could start recording, capture log data, and then send it to themselves. I guess if CatLog itself could still capture the Intent and ask the user to confirm, it would be okay, but at that point you might as well just use the widget.

      I’m not sure about this one. Email me if you have some specific ideas, though, and I’ll consider it.

      Reply

  2. This is very nice thanks! Is there any way to use this with tasker?

    Reply

  3. Thanks for your quick reply. Tasker is basically a program used to automate processes/tasks. It allows the user to set conditions for triggers, and actions to be preformed upon those triggers. There are many apps with plugins for tasker already. More info can be found here:
    http://www.appbrain.com/app/tasker/net.dinglisch.android.taskerm
    http://tasker.dinglisch.net/index.html
    For my purpose, it would be nice to have a plugin for CatLog that would allow for the automatic starting of the logcat recording. For instance, when my phone boots, it would be nice to have it start the recording process.
    At any rate, whether or not this is something you want to implement, I do appreciate your time and work on Catlog.

    Reply

  4. […] information that should be private. Any advice on this would be greatly appreciated. cheers. CatLog now supports external Intents Read the Tea Leaves […]

    Reply

  5. […] information that should be private. Any advice on this would be greatly appreciated. cheers. CatLog now supports external Intents Read the Tea Leaves Reply With […]

    Reply

  6. Posted by Hanz on May 11, 2012 at 3:46 PM

    Hi, it looks like good application, but it not working for me. after start is the background still black, no logs here. If I press “record”, toast “Log recording started” apears and after one second apears “Log saved”. nothing happens and log files are zero size. can you help me with this? thanks

    Reply

    • Posted by Hanz on July 10, 2012 at 1:45 PM

      still not working. is your app only for rooted devices? or where you thing problem is. thanks Hanz

      Reply

      • CatLog works on rooted phones, but it does not work on certain ROMs, if the ROM developers have disabled LogCat or the READ_LOGS permission. I’ve had lots of complaints from various users about this, and it always seems to come down to a ROM issue. So I’d recommend you test some of CatLog’s competitors to confirm the bug, and then report it to the ROM developers.

      • Posted by Hanz on July 10, 2012 at 2:39 PM

        now it’s ok. I find problem with setting on my huawei and there is solution if other people will have same problem (huawei device only):
        Dial

        *#*#2846579#*#*

        and you will see a hidden menu. Go ProjectMenu / Background Setting / Log setting and define the log availability (log swith) and level (log level setting).

        web: http://stackoverflow.com/questions/2250112/why-doesnt-logcat-show-anything-in-my-android

        btw. thanks for good application

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: