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

System.out.println entries are not captured in quarkus.log #6766

Open
rsvoboda opened this issue Jan 24, 2020 · 7 comments
Open

System.out.println entries are not captured in quarkus.log #6766

rsvoboda opened this issue Jan 24, 2020 · 7 comments
Labels
kind/enhancement New feature or request

Comments

@rsvoboda
Copy link
Member

System.out.println entries are not captured in quarkus.log
Only entries from org.jboss.logging.Logger are captured in quarkus.log

I checked https://quarkus.io/guides/logging but didn't find any info about System.out.println entries not beeing captured.

Reproducer:
build and run my-quarkus-project.zip

mvn package
java -Dquarkus.log.file.enable=true -Dquarkus.log.file.rotation.max-file-size=10k -Dquarkus.log.file.rotation.max-backup-index=20 -jar target/my-quarkus-project-1.0-SNAPSHOT-runner.jar

In the second terminal execute

for i in {1..1000}; do curl 127.0.0.1:8080/hello; sleep 0.1; done

Hello endpoint contains this snippet of the code

        System.out.println(" Fooooooooo ");
        LOGGER.info("logger foooo");

In the third terminal execute

tail -f quarkus.log

You will see something like this:

2020-01-24 11:52:37,195 rs my-quarkus-project-1.0-SNAPSHOT-runner.jar[45482] INFO  [org.acm.qua.sam.HelloResource] (executor-thread-1) logger foooo
2020-01-24 11:52:38,213 rs my-quarkus-project-1.0-SNAPSHOT-runner.jar[45482] INFO  [org.acm.qua.sam.HelloResource] (executor-thread-1) logger foooo
2020-01-24 11:52:39,233 rs my-quarkus-project-1.0-SNAPSHOT-runner.jar[45482] INFO  [org.acm.qua.sam.HelloResource] (executor-thread-1) logger foooo
2020-01-24 11:52:40,256 rs my-quarkus-project-1.0-SNAPSHOT-runner.jar[45482] INFO  [org.acm.qua.sam.HelloResource] (executor-thread-1) logger foooo
@rsvoboda rsvoboda added the kind/bug Something isn't working label Jan 24, 2020
@gsmet
Copy link
Member

gsmet commented Jan 24, 2020

Why would they be? System.out writes to the standard output not to a log file.

I don't think that it's a bug, it's expected.

@rsvoboda
Copy link
Member Author

I picked bug type as it looks like a regression to me.
I comparw this behavior with WildFly / EAP which tunnels stout through jboss-logging.

On WF I see 2020-01-24 15:03:41,570 INFO [stdout] (default task-1) foooooo messages logged in server log file when the endpoint uses System.out.println.

This could be considered as enhancement for sure.
@dmlloyd, can you share an idea what would be needed to do to have stdout captured by jboss-logging on Quarksu ?

@gsmet
Copy link
Member

gsmet commented Jan 24, 2020

Well, I don't see that as an enhancement personally but I'll let @dmlloyd decide.

@gsmet gsmet added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Jan 24, 2020
@dmlloyd
Copy link
Member

dmlloyd commented Jan 27, 2020

We implemented that at user request. But Quarkus would not want to do that (by default at least) because several classes of application may need clean access to stdin/stdout, particularly applications running in certain kinds of containers and CLI applications.

That said, it might be worth having a configuration switch or even an extension which grabs stdout and/or stderr.

@yvespp
Copy link

yvespp commented Apr 28, 2020

I'm trying to use the Azure Application Insights Java agent with quarkus which writes all it's logs to stderr.
I can't get it to work and can't see any errors from it because quarkus ignores them.

Please add a way to see what gets logged to stdout and stderr.

@yvespp
Copy link

yvespp commented Apr 28, 2020

Never mind, I can see them in the console log when I increase the Application Insights log level.

@akastyka-kaseya
Copy link

He have an Quarkus application which uses some libraries with printing information into stdout.
For example simple javax.net.debug=all prints to stdout which makes it difficult to get logs from customers with required information.

Is there any possibility to redirect stdout to a file (with Quarkus configuration ) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants