• Advertisement
Sign in to follow this  

Unable to view log info in LogCat with Android app

This topic is 917 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to send log messages so that I can see the output in LogCat via Eclipse. I tried it with the Android and SDL call but nothing shows up in Log Cat. I set the filter to "verbos" or "debug" but none of the information is displayed.

 

Is there a trick to this or am I doing something wrong.

 

Had to apply a fix to Eclipse so that it would show all the LogCat tabs so I do see all the info.

void CStatCounter::IncCycle( SDL_Window * m_pWindow )
{
    // These counters are incremeented each game loop cycle so they can
    // be placed here in this function because this function is also called
    // each game loop cycle
    m_elapsedFPSCounter += CHighResTimer::Instance().GetFPS();

    ++m_cycleCounter;

    // update the stats every 500 miliseconds
    if( m_statsDisplayTimer.Expired(CTimer::RESTART_ON_EXPIRE) )
    {
        // Show the output
        #if defined(__ANDROID__)
    	__android_log_print(ANDROID_LOG_DEBUG, "Lap Cat Games", "%s", "Test Message");
        #else
        if( !CSettings::Instance().GetFullScreen() )
            SDL_SetWindowTitle( m_pWindow, GetStatString().c_str() );
        #endif

        // Now that the stats are displayed, we can reset out counters.
        ResetCounters();
    }

}   // HasCycleCompleted

or

void CStatCounter::IncCycle( SDL_Window * m_pWindow )
{
    // These counters are incremeented each game loop cycle so they can
    // be placed here in this function because this function is also called
    // each game loop cycle
    m_elapsedFPSCounter += CHighResTimer::Instance().GetFPS();

    ++m_cycleCounter;

    // update the stats every 500 miliseconds
    if( m_statsDisplayTimer.Expired(CTimer::RESTART_ON_EXPIRE) )
    {
        // Show the output
        #if defined(__IPHONEOS__) || defined(__ANDROID__)
        SDL_LogDebug( SDL_LOG_CATEGORY_RENDER, "%s", GetStatString().c_str() );
        #else
        if( !CSettings::Instance().GetFullScreen() )
            SDL_SetWindowTitle( m_pWindow, GetStatString().c_str() );
        #endif

        // Now that the stats are displayed, we can reset out counters.
        ResetCounters();
    }

}   // HasCycleCompleted

Share this post


Link to post
Share on other sites
Advertisement

The logcat window in Eclipse is... not very good...

 

I always use "adb logcat" in a terminal instead, piped through a grep regexp to filter out the interesting stuff in the flood of nonsense.

Much more reliable.

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

The logcat window in Eclipse is... not very good...
 
I always use "adb logcat" in a terminal instead

 
Agreed here, adb logcat is the easiest way to go
 
He is right about all the nonsense / fluff in the logs. In my setup, unfortunately, I have 2 logcat windows running.
One that has everything logcat spits out (errors, opengl errors, segfaults, and etc) and the other window shows the messages with the tag I'm using (__android_log_print error, verbose, debug, and etc)
 

grep regexp to filter out the interesting stuff in the flood of nonsense.


Im interested in what are you greping on? I wonder if windows (my dev environment) can do the same with find / findstr.

Do your logs pull back everything for your application like what Android Studio would do? Pull back all the messages that come out of the application.

Share this post


Link to post
Share on other sites

It's nothing special, just looks for the tags I use, plus some system ones that have been useful and not too spammy. ("DEBUG" and "ActivityManager")

Put into a shell script in my project dir.

looks like this:

adb logcat | grep -E I\/DEBUG\|jni\/\|W\/ActivityManager\|JNI\|\/FU\|GLView

 

It's far from perfect...

Then I have a "logcat-pid" script which just grep for a process id I provide as argument, to see if I missed something in the first one...

 

If I'm still scratching my head, its over to the full logcat pasted into a text editor... 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement