quarkusio / quarkus

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

LogManager error of type GENERIC_FAILURE: Handler with name 'console' is linked to a category but not configured. #42166

Closed starksm64 closed 1 week ago

starksm64 commented 1 month ago

Describe the bug

Why is this error generated on a simple logging usecase? Even after reading the https://quarkus.io/guides/logging#console-log-handler section and named handlers section I have no idea what the error is, or what category the console handler is linked to that is the problem. I would assume it is the default root category, in which case this should be handled.

I am using the simplified io.quarkus.logging.Log interface in the app.


# Root resource directory for *.fxml files
quarkus.fx.fxml-root=/fxml/
quarkus.fx.style-root=/style/

# Logging
quarkus.log.level=INFO
quarkus.log.handlers=console,file

quarkus.log.console.enable=true
quarkus.log.console.level=INFO
quarkus.log.console.stderr=true
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) %s%e%n
quarkus.log.file.enable=true
quarkus.log.file.level=TRACE
quarkus.log.file.path=application.log
quarkus.log.file.format=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) %s%e%n

quarkus.log.category."tck.jakarta.platform".min-level=TRACE
quarkus.log.category."tck.jakarta.platform".level=TRACE
quarkus.log.category."tck.jakarta.rewrite".min-level=TRACE
quarkus.log.category."tck.jakarta.rewrite".level=TRACE

Expected behavior

Either there should be no error, or a suggestion on what to fix is in the error message, or the https://quarkus.io/guides/logging#console-log-handler should cover this error.

Actual behavior

An error with no explanation

How to Reproduce?

  1. git clone https://github.com/eclipse-ee4j/jakartaee-tck-tools
  2. cd jakartaee-tck-tools/tools/tck-rewrite-fx
  3. mvn package
...
[INFO] --- quarkus:3.12.2:build (default) @ tck-rewrite-fx ---
LogManager error of type GENERIC_FAILURE: Handler with name 'console' is linked to a category but not configured.
[INFO] [io.quarkiverse.fx.deployment.QuarkusFxExtensionProcessor] Fx views : {}
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 737ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.648 s
[INFO] Finished at: 2024-07-26T09:13:50-06:00
[INFO] ------------------------------------------------------------------------
starksm@Scotts-Mac-Studio tck-rewrite-fx % 

Output of uname -a or ver

Darwin Scotts-Mac-Studio.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Apr 24 06:05:14 PDT 2024; root:xnu-8020.240.18.708.4~1/RELEASE_ARM64_T6000 arm6

Output of java -version

openjdk version "21.0.1" 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode

Quarkus version or git rev

3.12.2

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

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /Users/starksm/bin/apache-maven-3.9.6 Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "12.7.5", arch: "aarch64", family: "mac"

Additional information

No response

quarkus-bot[bot] commented 1 month ago

/cc @radcortez (config)

starksm64 commented 1 month ago

So the problem is the inclusion of this line from the logging config guide:

quarkus.log.handlers=console,file

This is not seen as attaching the default console and file handlers to the root category, rather these are new handlers that need a new configuration. The document refers to quarkus.log.handlers in 3 places:

// Ex 1
Example 1. An example of a global configuration that applies to all categories:

quarkus.log.handlers=console,mylog

// Ex2
Although the root logger’s handlers are usually configured directly via quarkus.log.console, quarkus.log.file and quarkus.log.syslog, it can nonetheless have additional named handlers attached to it using the quarkus.log.handlers property.

// Ex3
# configure a named file handler that sends the output to 'quarkus.log'
quarkus.log.handler.file.CONSOLE_MIRROR.enable=true
quarkus.log.handler.file.CONSOLE_MIRROR.path=quarkus.log
# attach the handler to the root logger
quarkus.log.handlers=CONSOLE_MIRROR

Only Ex3 is consistent with the current behavior. Ex1 will cause the error message indicated in this issue for the console handler unless one adds a confusing configuration entry like:

quarkus.log.handler.console.console.enable=true

and then it is another ConsoleHandler instance, not the default one.

geoand commented 1 month ago

cc @dmlloyd @jamezp

jamezp commented 1 month ago

I'm not too sure how useful I'd be here TBH. I don't really know much about how Quarkus does logging. At some point I could have a look, but it's going to a bit because I've got some other things that need to get done first and I'd have to learn about logging in Quarkus.

David is also on PTO so I'm not too sure who else knows about logging in Quarkus. This issue seems specific to Quarkus and not the log manager.

geoand commented 1 month ago

Thanks @jamezp.

I'll have to take a look at this (hopefully soon)

geoand commented 1 month ago

I agree that

// Ex 1
Example 1. An example of a global configuration that applies to all categories:

is missleading as it assumes that the user has already configured "named handlers" like so:

quarkus.log.handler.console.console.enable=true
quarkus.log.handler.file.mylog.enable=true
dmlloyd commented 1 week ago

Yes the doc is clearly incorrect here and should be fixed.