quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.54k stars 2.61k forks source link

Logs sent to two files with default configuration #25424

Open oliviercailloux opened 2 years ago

oliviercailloux commented 2 years ago

Describe the bug

With quarkus.log.file.enable (in supplement to the default console log), running mvn test creates two quarkus.log files instead of one as expected. One is in the project root (in the folder containing pom.xml) and contains a single line: INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final. The other one is in the target subfolder and contains (almost) all the rest of the log, i.e., for example, DEBUG [org.hib.SQL] (JPA Startup Thread: <default>)

One line is missing entirely from the file logs, but appears in the console logs: INFO [org.jbo.res.plu.val.i18n] (main) RESTEASY008550: Unable to find CDI supporting ValidatorFactory. Using default ValidatorFactory.

I suspect a timing problem, probably a thread starts writing in a log file before another thread takes over and writes in another log file. My computer is quite old so perhaps this is not visible with more modern (faster) computers.

Running the tests through mvn quarkus:dev does not exhibit that problem (the logs all end up in the same file).

Expected behavior

A single file contains all the log entries.

Actual behavior

The log entries are dispatched among two files, and one logging statement is missing entirely.

How to Reproduce?

https://github.com/oliviercailloux/Diet-server/tree/dupl-log

Output of uname -a or ver

Linux saucisson 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux

Output of java -version

openjdk version "17.0.3" 2022-04-19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.8.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3

Additional information

AMD® Athlon(tm) ii x2 250 processor × 2

JiriOndrusek commented 2 years ago

I've encountered a similar problem (but with different use-case).

I wanted to configure different file to log into. I changed appropriate application.properties. (quarkus.log.file.enable=true and quarkus.log.file.path=target/test.log)

The result is, that my custom file target/test.log contains only 1 line. The rest of the log is present in target/quarkus.log.

(Problem can be easily simulated from my fork of quarkus-quickstarts - getting-started https://github.com/JiriOndrusek/quarkus-quickstarts/tree/logging_error/getting-started)

famod commented 2 years ago

@JiriOndrusek sounds familiar: #10233 (link fixed)

JiriOndrusek commented 2 years ago

@famod thanks for the link!