0

I am porting a system im doing for a desktop application to android as a jar included in the app.

Is there a way to use the system.out.println(present in the jar) and see them logged on logcat(or anywhere else)?

I am currently debugging on a real device using adb from eclipse, and im correctly seeing the device logs in logcat console but not the standard output.

Yggdrasil
  • 43
  • 9
  • Why would you use `system.out.println`? You can use `Log.d('Log entry', 'some log entry description or event')` – ImAtWar Jun 01 '17 at 14:40
  • i am including java code that i use for a desktop application (and that has not android in its build path), i need to debug how that code fares on android devices so i need the results of the system.out inside that jar. – Yggdrasil Jun 01 '17 at 14:44
  • Apparently all of `System.out.println` calls are lost in android. https://stackoverflow.com/questions/2220547/why-doesnt-system-out-println-work-in-android – ImAtWar Jun 01 '17 at 14:48

1 Answers1

0

See this question. Basically, no. To log in Android, you must use a Log. Log.i, Log.d, Log.v, etc. There are a few different flavors of logs you can use, and filter through those in the Android Monitor. You'll have to manually convert your System.out.println to logs.

However you could RegEx replace them.

1) Not sure in Eclipse, but use the hotkeys to get into the 'replace all in file path' window (ctrl + shift + r in Android Studio).

2) Make sure Regular Expression (RegEx) is turned on

3) in the 'find' field, just type in

system.out.println\(

4) replace with

Log\.d("TAG",

And you should be good to go.

Josh Beckwith
  • 1,432
  • 3
  • 20
  • 38
  • haw.. so its a no. i will have also to change e.printStackTrace( to Log.e(APP_TAG, Log.getStackTraceString(e) and include android in the build path of each project i guess... and then switch back to how it was... each time... – Yggdrasil Jun 01 '17 at 14:51