How to print log of library project in android?
Asked Answered
T

2

7

I have one android project in which I have included 3 other android library project and I am using eclipse. I have tried to print log from the library project, but it only prints the log of the main project only.

So can any body tell me how to print the log of library project which is included in the main project?

My main project is com.project1.app, in which I logged as below.

Log.i(TAG,"Log From Main Project1");

Library project is com.subLibrary.subLibraryapp, in which I logged as below.

Log.i(TAG,"Log From Main Library Project");

But in LogCat I am able to see log only from com.project1.app shown as below.

com.project1.app    |   Log From Main Project1

Have I done any mistake or I have to open any other window, Can anybody please suggest me?

Toscana answered 2/3, 2013 at 6:21 Comment(1)
have you tried to reopen the projects and clean them (both the library and main project)?Blacktop
L
2

I'm guessing that your application and the library have different tags.

If you're using the command line to read logs, you need to do something like

adb logcat -s yourtag:V librarytag:V

If you're using Eclipse to read your logcat output, try creating a filter specific to your app.

Lambency answered 2/3, 2013 at 16:56 Comment(0)
V
0

Here’s one of the simplest library, which I published few days back. On the contrary to normal Log library, you can work with only single message parameter. It’ll print you the LINE number and the METHOD name as well.

One of the best thing is, you don’t have to delete the logs when in release build. Follow these simple steps.

Step 1: Add jitpack to root level gradle,

allprojects {
    repositories {
       maven { url 'https://jitpack.io' }
    }
}

Step 2: Then Just import,

dependencies {
    compile 'com.github.sujay219:LogHere:1.0.10'
}

Step 3: Initialize and use,

// Initialise in your main activity
LogHere.initialize(BuildConfig.DEBUG, LogHere.ERROR, "wildox”);

// Logging line, single param
LogHere.e(“this is message”);

For more details,

https://github.com/sujay219/LogHere

Velamen answered 21/2, 2018 at 14:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.