Skip to content

Commit

Permalink
Merge pull request quarkusio#46103 from MichalMaler/Logging-guide-tex…
Browse files Browse the repository at this point in the history
…t-review

Brief review for the Logging guide
  • Loading branch information
Ladicek authored Feb 5, 2025
2 parents 3e26882 + 3d60723 commit c52d210
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions docs/src/main/asciidoc/logging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ class SimpleBean {
<1> The fully qualified class name (FQCN) of the declaring class is used as a logger name, for example, `org.jboss.logging.Logger.getLogger(SimpleBean.class)` will be used.
<2> In this case, the name _foo_ is used as a logger name, for example, `org.jboss.logging.Logger.getLogger("foo")` will be used.

NOTE: The logger instances are cached internally.
[NOTE]
====
The logger instances are cached internally.
Therefore, when a logger is injected, for example, into a `@RequestScoped` bean, it is shared for all bean instances to avoid possible performance penalties associated with logger instantiation.

====

== Use log levels

Expand Down Expand Up @@ -530,12 +532,9 @@ For details about its configuration, see the xref:#quarkus-core_section_quarkus-

=== Socket log handler

This handler will send the logs to a socket.
It is disabled by default, so you must first enable it.
When enabled, it sends all log events to a socket, for instance to a Logstash server.

This will typically be used in conjunction with the `quarkus-logging-json` extension so send logs in ECS format to an Elasticsearch instance.
An example configuration can be found in the xref:centralized-log-management.adoc[Centralized log management] guide.
This handler sends logs to a socket.
Socket log handler is disabled by default; enable it to use it.
When enabled, it sends all log events to a socket, such as a Logstash server.

* A global configuration example:
+
Expand All @@ -545,6 +544,9 @@ quarkus.log.socket.enable=true
quarkus.log.socket.endpoint=localhost:4560
----

Typically, this handler is used with the `quarkus-logging-json` extension to send logs in ECS format to an Elasticsearch instance.
For an example configuration, see the xref:centralized-log-management.adoc[Centralized log management] guide.


== Add a logging filter to your log handler

Expand Down Expand Up @@ -610,8 +612,11 @@ quarkus.console.color=false
quarkus.log.category."io.quarkus".level=INFO
----

NOTE: If you add these properties in the command line, ensure `"` is escaped.
[NOTE]
====
If you add these properties in the command line, ensure `"` is escaped.
For example, `-Dquarkus.log.category.\"io.quarkus\".level=DEBUG`.
====

[[category-example]]
.File TRACE logging configuration
Expand Down Expand Up @@ -667,7 +672,7 @@ To send logs to a centralized tool such as Graylog, Logstash, or Fluentd, see th


=== OpenTelemetry logging
Logging entries from all appenders can be sent using OpenTelemetry Logging.
Logging entries from all appenders can be sent by using OpenTelemetry Logging.

For details, see the Quarkus xref:opentelemetry-logging.adoc[OpenTelemetry Logging] guide.

Expand All @@ -677,7 +682,7 @@ Enable proper logging for `@QuarkusTest` by setting the `java.util.logging.manag

The system property must be set early on to be effective, so it is recommended to configure it in the build system.

.Setting the `java.util.logging.manager` system property in the Maven Surefire plugin configuration
.Setting the `java.util.logging.manager` system property in the Maven Surefire plugin configuration:
[source, xml]
----
<build>
Expand Down Expand Up @@ -822,7 +827,7 @@ To add data to the MDC and extract it in your log output:

. Use the `MDC` class to set the data.
.. Add `import org.jboss.logmanager.MDC;`
.. Set `MDC.put(...)` as shown in the example below:
.. Set `MDC.put(...)` as shown in the example below:
+
[source,java]
.An example with JBoss Logging and `io.quarkus.logging.Log`
Expand Down

0 comments on commit c52d210

Please sign in to comment.