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.
Configuration property fixed at build time - ️ Configuration property overridable at runtime
Type |
Default |
|
---|---|---|
The default log level |
||
The default minimum log level |
|
|
Type |
Default |
|
The minimum level that this category can be set to |
string |
|
The log level level for this category |
string |
|
Type |
Default |
|
If console logging should be enabled |
boolean |
|
The log format |
string |
|
The console log level |
|
|
If the console logging should be in color. If undefined quarkus takes best guess based on operating system and environment. |
boolean |
|
Specify how much the colors should be darkened |
int |
|
Indicates whether to log asynchronously |
boolean |
|
The queue length to use before flushing writing |
int |
|
Determine whether to block the publisher (rather than drop the message) when the queue is full |
|
|
Type |
Default |
|
If file logging should be enabled |
boolean |
|
The log format |
string |
|
The level of logs to be written into the file. |
|
|
The name of the file in which logs will be written. |
|
|
Indicates whether to log asynchronously |
boolean |
|
The queue length to use before flushing writing |
int |
|
Determine whether to block the publisher (rather than drop the message) when the queue is full |
|
|
The maximum file size of the log file after which a rotation is executed. |
||
The maximum number of backups to keep. |
int |
|
File handler rotation file suffix. Example fileSuffix: .yyyy-MM-dd |
string |
|
Indicates whether to rotate log files on server initialization. |
boolean |
|
Type |
Default |
|
If syslog logging should be enabled |
boolean |
|
The IP address and port of the syslog server |
host:port |
|
The app name used when formatting the message in RFC5424 format |
string |
|
The name of the host the messages are being sent from |
string |
|
Sets the facility used when calculating the priority of the message as defined by RFC-5424 and RFC-3164 |
|
|
Set the |
|
|
Sets the protocol used to connect to the syslog server |
|
|
Set to |
boolean |
|
Set to |
boolean |
|
Enables or disables blocking when attempting to reconnect a |
boolean |
|
The log message format |
string |
|
The log level specifying, which message levels will be logged by syslog logger |
|
|
Indicates whether to log asynchronously |
boolean |
|
The queue length to use before flushing writing |
int |
|
Determine whether to block the publisher (rather than drop the message) when the queue is full |
|
|
Type |
Default |
|
The message starts to match |
list of string |
|
About the MemorySize format
A size configuration option recognises string in this format (shown as a regular expression): |
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