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

Missing task output during custom task developing. #21395

Open
demqa opened this issue Jul 28, 2022 · 0 comments
Open

Missing task output during custom task developing. #21395

demqa opened this issue Jul 28, 2022 · 0 comments

Comments

@demqa
Copy link

demqa commented Jul 28, 2022

Issue: Missing task output without using logger.

I am developing Gradle Plugin. I have to use coroutines, that write output within task execution label like this: > Task :my-task.
But it does not work, and coroutines' output goes beyond this label.
I watched Gradle Logging API. There was a function seems to solve my problem: LoggingManager.captureStandardOutput(LogLevel level). But it does not work as I expected.

Expected Behavior

Coroutines' output will be within task execution scope.

Current Behavior

Coroutines' output appears outside of task execution scope, usually above.

There are output examples in README.md in the project I attach to issue below.

Addition

I have shown in the example below achieving behaviour what I expected using Task Logger. Would not it be better if there
will be more examples in documentation using logger, not standard println. API Users will keep in mind
to use logger instead of println. I had lost a lot of time trying to figure out what is happening in
my code and why.

I think that examples in the documentation should be rewritten using logger. For example there and there.

Actually the same problem will appear if you will try to use java.lang.Thread to write in stdout.

Steps to Reproduce

I did a little example to show it.

You have actually to build&publish plugin & to hook it up to any project, and call ./gradlew my-task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants