This guide explains logging and how to configure it.
Run Time Configuration
Run time configuration of logging is done through the normal application.properties
file.
Console configuration
Console logging is enabled by default. To configure or disable it, the following configuration properties are used:
Property Name | Default | Description |
---|---|---|
|
|
Determine whether console logging is enabled. |
|
|
The format pattern to use for logging to the console; see Format String. |
|
|
The minimum log level to display to the console. |
|
|
Allow color rendering to be used on the console, if it is supported by the terminal. |
|
|
Indicates whether to log asynchronously. |
|
|
The queue length to use before flushing writing. |
|
|
Determine whether to block the publisher (rather than drop the message) when the queue is full. |
File configuration
Logging to a file is also supported but not enabled by default. To configure or enable this behavior, use the following configuration properties:
Property Name | Default | Description |
---|---|---|
|
|
Determine whether file logging is enabled. |
|
|
The format pattern to use for logging to a file; see Format String. |
|
|
The minimum log level to write to the log file. |
|
|
The path of the log file. |
|
The maximum file size of the log file after which a rotation is executed. This configuration option would recognize strings in this format (shown as a regular expression): |
|
|
|
The maximum number of backups to keep. |
|
Rotating log file suffix. The format of suffix value has to be understood by |
|
|
|
Indicates whether to rotate log files on server initialization. |
|
|
Indicates whether to log asynchronously. |
|
|
The queue length to use before flushing writing. |
|
|
Determine whether to block the publisher (rather than drop the message) when the queue is full. |
Syslog configuration
Logging to a syslog is also supported but not enabled by default. To configure or enable this behavior, use the following configuration properties:
Property Name | Default | Description |
---|---|---|
|
|
Determine whether syslog logging is enabled. |
|
|
The format pattern to use for logging to syslog; see Format String. |
|
|
The minimum log level to write to syslog. |
|
|
The IP address and port of the syslog server. |
|
|
The app name used when formatting the message in RFC5424 format. |
|
|
The name of the host the messages are being sent from. |
|
|
The facility used when calculating the priority of the message as defined by RFC-5424 and RFC-3164. |
|
|
The syslog type which handler should use to format the message sent. |
|
|
The protocol used to connect to the syslog server. |
|
|
Determine whether the message being sent should be prefixed with the size of the message. |
|
|
Indicates whether the message should be truncated. |
|
|
Determine whether to block when attempting to reconnect on TCP or SSL TCP protocols |
|
|
Indicates whether to log asynchronously. |
|
|
The queue length to use before flushing writing. |
|
|
Determine whether to block the publisher (rather than drop the message) when the queue is full. |
Logging categories
Logging is done on a per-category basis. Each category can be independently configured. A configuration which applies to a category will also apply to all sub-categories of that category, unless there is a more specific matching sub-category configuration.
Property Name | Default | Description |
---|---|---|
|
|
The level to use to configure the category named |
The quotes shown in the property name are required as categories normally contain '.' which must be escaped. An example is shown in File TRACE Logging Configuration. |
Format String
The logging format string supports the following symbols:
Symbol | Summary | Description |
---|---|---|
|
|
Renders a simple |
|
Category |
Renders the category name. |
|
Source class |
Renders the source class name.[2] |
|
Date |
Renders a date with the given date format string, which uses the syntax defined by |
|
Exception |
Renders the thrown exception, if any. |
|
Source file |
Renders the source file name.[2] |
|
Host name |
Renders the system simple host name. |
|
Qualified host name |
Renders the system’s fully qualified host name, which may be the same as the simple host name, depending on OS configuration. |
|
Process ID |
Render the current process PID. |
|
Source location |
Renders the source location information, which includes source file name, line number, class name, and method name.[2] |
|
Source line |
Renders the source line number.[2] |
|
Full Message |
Renders the log message plus exception (if any). |
|
Source method |
Renders the source method name.[2] |
|
Newline |
Renders the platform-specific line separator string. |
|
Process name |
Render the name of the current process. |
|
Level |
Render the log level of the message. |
|
Relative time |
Render the time in milliseconds since the start of the application log. |
|
Simple message |
Renders just the log message, with no exception trace. |
|
Thread name |
Render the thread name. |
|
Thread ID |
Render the thread ID. |
|
Time zone |
Set the time zone of the output to |
|
Mapped Diagnostics Context Value |
Renders the value from Mapped Diagnostics Context |
|
Mapped Diagnostics Context Values |
Renders all the values from Mapped Diagnostics Context in format {property.key=property.value} |
|
Nested Diagnostics context values |
Renders all the values from Nested Diagnostics Context in format {value1.value2} |
Examples
quarkus.log.console.enable=true
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
quarkus.log.console.level=DEBUG
quarkus.log.console.color=false
quarkus.log.category."io.quarkus".level=DEBUG
If you are adding these properties via command line make sure " is escaped.
For example -Dquarkus.log.category.\"io.quarkus\".level=DEBUG .
|
quarkus.log.file.enable=true
# Send output to a trace.log file under the /tmp directory
quarkus.log.file.path=/tmp/trace.log
quarkus.log.file.level=TRACE
quarkus.log.file.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
# Set 2 categories (io.quarkus.smallrye.jwt, io.undertow.request.security) to TRACE level
quarkus.log.category."io.quarkus.smallrye.jwt".level=TRACE
quarkus.log.category."io.undertow.request.security".level=TRACE