From 9b166e8af804b08da0fbb27ef6caf13ffafb61b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=A9=C5=99?= Date: Thu, 28 Nov 2024 11:55:08 +0100 Subject: [PATCH] logging-and-datasource-docstyle-review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Maléř --- docs/src/main/asciidoc/datasource.adoc | 9 ++++----- docs/src/main/asciidoc/logging.adoc | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/src/main/asciidoc/datasource.adoc b/docs/src/main/asciidoc/datasource.adoc index 974157657ffa39..0677ac06c49de1 100644 --- a/docs/src/main/asciidoc/datasource.adoc +++ b/docs/src/main/asciidoc/datasource.adoc @@ -259,12 +259,11 @@ For more information about configuring JDBC, see < Finally, all calls to `Log` methods are rewritten to regular JBoss Logging calls on the logger field during the application build. -WARNING: Only use the `Log` API in application classes, not in external dependencies. -`Log` method calls that are not processed by Quarkus at build time will throw an exception. +[WARNING] +==== +Use the `Log` API only in application classes, not in external dependencies. +`Log` method calls not processed by Quarkus at build time will result in an exception. -[[log-api-extension-warning]] -==== Important Note on Using `io.quarkus.logging.Log` in Extensions +.Using `io.quarkus.logging.Log` in extensions: -While the `Log` API simplifies logging in application classes, it should not be used in extension modules or external dependencies. The following considerations apply: +While the `Log` API simplifies logging in application classes, it is not recommended for use in extension modules or external dependencies. -* `io.quarkus.logging.Log` depends on Quarkus bytecode transformations that occur at build time. -* In extension modules, the use of `Log` may work if the module has a Jandex index. However, this behavior is not officially supported and might lead to unreliable logging. +The following considerations apply: -For extension development: +* `io.quarkus.logging.Log` depends on Quarkus bytecode transformations that occur at build time. -* Use standard loggers like `org.jboss.logging.Logger.getLogger(String)` instead of `io.quarkus.logging.Log`. -* This avoids potential performance issues caused by the stack walk fallback when Quarkus build-time processing is unavailable. +* In extension modules, `Log` works only if the module includes a Jandex index. +However, this behavior is unsupported and can lead to unreliable logging. ++ +For extension development, use `org.jboss.logging.Logger.getLogger(String)` instead of `io.quarkus.logging.Log`. +==== [[injection-of-a-configured-logger]]