简体   繁体   中英

See the log of a jar in android (adb)

i've a question: how can i see the log of a library, which is used as jar into my android app, in the logcat ? Is is also possible to redirect it to a file stored into the sd of the android?

To make it clear, the jar libary uses: import java.util.logging.Logger; where the logger is created as follow private static Logger logger = Logger.getLogger(StreamingEngine.class.getName());

and then the various level as logger.info("..");

if i check the logcat i don't see anything from that library. is it my fault (that i don't know how to query logcat) or what?

You can write a wrapper which does both logging action

public class Log
{
    private static Logger logger = Logger.getLogger("MAIN_LOGGER"); 

    // info
    public static void i(String tag, String message)
    {
        // logcat
        android.util.Log.i(tag, message);

        // log4j
        logger.info("[" + tag + "] " + message);
    }

    // TODO other levels
}

It can be improve of course.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM