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?

Hartok
  • 2,147
  • 20
  • 37
Jayeshkumar Sojitra
  • 2,501
  • 4
  • 31
  • 44

2 Answers2

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.

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
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

Sujay Kumar
  • 520
  • 8
  • 19