Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to output Logger.e to console when running junit test in android studio #26

Closed
henrytao-me opened this issue May 3, 2015 · 6 comments
Assignees

Comments

@henrytao-me
Copy link

Hi there,
The title is pretty obvious. I am be able to print log to console with e.printStackTrace() when running unit test in android studio but Logger.e(JsonUtils.class.getName(), jsonString, e).

Thanks in advance!

@orhanobut
Copy link
Owner

Hi, let me check this issue.

@IgorGanapolsky
Copy link

I too am curious how to log console output from junit test. Any update on this?

@orhanobut
Copy link
Owner

This is something I'm working on but on a different level though. I'm trying to show the output log quite differently for unit tests.

@IgorGanapolsky
Copy link

IgorGanapolsky commented Oct 25, 2016

Well, silly me. One can just use System.err.println(), and it will log.

@orhanobut orhanobut self-assigned this May 28, 2017
@orhanobut orhanobut added this to the 2.1.0 milestone May 28, 2017
@orhanobut
Copy link
Owner

I'll add a built-in LogAdapter to support System logs.

@orhanobut
Copy link
Owner

With a custom LogStrategy it's doable. Long time that I couldn't check this issue. One of the earliest issues. Closing this one since It can be done easily with custom LogStrategy. Looks quite nice in tests.

val formatStrategy = PrettyFormatStrategy.newBuilder()
    .logStrategy { priority, tag, message -> println(message) }
    .build()
Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))

@orhanobut orhanobut removed this from the 2.1.0 milestone Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants