Quarkus - Configuring Logging

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

Configuration propertyTypeDefault
quarkus.log.levelThe default log levelLevel
quarkus.log.min-levelThe default minimum log levelLevelINFO
Logging categoriesTypeDefault
quarkus.log.category."categories".min-levelThe minimum level that this category can be set tostringinherit
quarkus.log.category."categories".levelThe log level level for this categorystringinherit
Console loggingTypeDefault
quarkus.log.console.enableIf console logging should be enabledbooleantrue
quarkus.log.console.formatThe log formatstring%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] (%t) %s%e%n
quarkus.log.console.levelThe console log levelLevelALL
quarkus.log.console.colorIf the console logging should be in color. If undefined quarkus takes best guess based on operating system and environment.boolean
quarkus.log.console.darkenSpecify how much the colors should be darkenedint0
quarkus.log.console.asyncIndicates whether to log asynchronouslybooleanfalse
quarkus.log.console.async.queue-lengthThe queue length to use before flushing writingint512
quarkus.log.console.async.overflowDetermine whether to block the publisher (rather than drop the message) when the queue is fullblock, discardblock
File loggingTypeDefault
quarkus.log.file.enableIf file logging should be enabledbooleanfalse
quarkus.log.file.formatThe log formatstring%d{yyyy-MM-dd HH:mm:ss,SSS} %h %N[%i] %-5p [%c{3.}] (%t) %s%e%n
quarkus.log.file.levelThe level of logs to be written into the file.LevelALL
quarkus.log.file.pathThe name of the file in which logs will be written.Filequarkus.log
quarkus.log.file.asyncIndicates whether to log asynchronouslybooleanfalse
quarkus.log.file.async.queue-lengthThe queue length to use before flushing writingint512
quarkus.log.file.async.overflowDetermine whether to block the publisher (rather than drop the message) when the queue is fullblock, discardblock
quarkus.log.file.rotation.max-file-sizeThe maximum file size of the log file after which a rotation is executed.MemorySize
quarkus.log.file.rotation.max-backup-indexThe maximum number of backups to keep.int1
quarkus.log.file.rotation.file-suffixFile handler rotation file suffix. Example fileSuffix: .yyyy-MM-ddstring
quarkus.log.file.rotation.rotate-on-bootIndicates whether to rotate log files on server initialization.booleantrue
Syslog loggingTypeDefault
quarkus.log.syslog.enableIf syslog logging should be enabledbooleanfalse
quarkus.log.syslog.endpointThe IP address and port of the syslog serverhost:portlocalhost:514
quarkus.log.syslog.app-nameThe app name used when formatting the message in RFC5424 formatstring
quarkus.log.syslog.hostnameThe name of the host the messages are being sent fromstring
quarkus.log.syslog.facilitySets the facility used when calculating the priority of the message as defined by RFC-5424 and RFC-3164kernel, user-level, mail-system, system-daemons, security, syslogd, line-printer, network-news, uucp, clock-daemon, security2, ftp-daemon, ntp, log-audit, log-alert, clock-daemon2, local-use-0, local-use-1, local-use-2, local-use-3, local-use-4, local-use-5, local-use-6, local-use-7user-level
quarkus.log.syslog.syslog-typeSet the SyslogType syslog type this handler should use to format the message sentrfc5424, rfc3164rfc5424
quarkus.log.syslog.protocolSets the protocol used to connect to the syslog servertcp, udp, ssl-tcptcp
quarkus.log.syslog.use-counting-framingSet to true if the message being sent should be prefixed with the size of the messagebooleanfalse
quarkus.log.syslog.truncateSet to true if the message should be truncatedbooleantrue
quarkus.log.syslog.block-on-reconnectEnables or disables blocking when attempting to reconnect a org.jboss.logmanager.handlers.SyslogHandler.Protocol#TCPTCP or org.jboss.logmanager.handlers.SyslogHandler.Protocol#SSL_TCP SSL TCP protocolbooleanfalse
quarkus.log.syslog.formatThe log message formatstring%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] (%t) %s%e%n
quarkus.log.syslog.levelThe log level specifying, which message levels will be logged by syslog loggerLevelALL
quarkus.log.syslog.asyncIndicates whether to log asynchronouslybooleanfalse
quarkus.log.syslog.async.queue-lengthThe queue length to use before flushing writingint512
quarkus.log.syslog.async.overflowDetermine whether to block the publisher (rather than drop the message) when the queue is fullblock, discardblock
Log cleanup filters - internal useTypeDefault
quarkus.log.filter."filters".if-starts-withThe message starts to matchlist of stringinherit
About the MemorySize formatA size configuration option recognises string in this format (shown as a regular expression): [0-9]+[KkMmGgTtPpEeZzYy]?.If no suffix is given, assume bytes.

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 NameDefaultDescription
quarkus.log.category."<category-name>".levelINFO [1]The level to use to configure the category named <category-name>. The quotes are necessary.
The quotes shown in the property name are required as categories normally contain '.' which mustbe escaped. An example is shown in File TRACE Logging Configuration.

Root logger configuration

The root logger category is handled separately, and is configured via the following properties:

Property NameDefaultDescription
quarkus.log.levelINFOThe default minimum log level for every log category.

Format String

The logging format string supports the following symbols:

SymbolSummaryDescription
%%%Renders a simple % character.
%cCategoryRenders the category name.
%CSource classRenders the source class name.[2]
%d{xxx}DateRenders a date with the given date format string, which uses the syntax defined by java.text.SimpleDateFormat.
%eExceptionRenders the thrown exception, if any.
%FSource fileRenders the source file name.[2]
%hHost nameRenders the system simple host name.
%HQualified host nameRenders the system’s fully qualified host name, which may be the same as the simple host name, depending on OS configuration.
%iProcess IDRender the current process PID.
%lSource locationRenders the source location information, which includes source file name, line number, class name, and method name.[2]
%LSource lineRenders the source line number.[2]
%mFull MessageRenders the log message plus exception (if any).
%MSource methodRenders the source method name.[2]
%nNewlineRenders the platform-specific line separator string.
%NProcess nameRender the name of the current process.
%pLevelRender the log level of the message.
%rRelative timeRender the time in milliseconds since the start of the application log.
%sSimple messageRenders just the log message, with no exception trace.
%tThread nameRender the thread name.
%t{id}Thread IDRender the thread ID.
%z{<zone name>}Time zoneSet the time zone of the output to <zone name>.
%X{<MDC property name>}Mapped Diagnostics Context ValueRenders the value from Mapped Diagnostics Context
%XMapped Diagnostics Context ValuesRenders all the values from Mapped Diagnostics Context in format {property.key=property.value}
%xNested Diagnostics context valuesRenders all the values from Nested Diagnostics Context in format {value1.value2}

Examples

Console DEBUG Logging, No color, Shortened Time, Shortened Category Prefixes

  1. quarkus.log.console.enable=true
  2. quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
  3. quarkus.log.console.level=DEBUG
  4. quarkus.log.console.color=false
  5. 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.

File TRACE Logging Configuration

  1. quarkus.log.file.enable=true
  2. # Send output to a trace.log file under the /tmp directory
  3. quarkus.log.file.path=/tmp/trace.log
  4. quarkus.log.file.level=TRACE
  5. quarkus.log.file.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
  6. # Set 2 categories (io.quarkus.smallrye.jwt, io.undertow.request.security) to TRACE level
  7. quarkus.log.category."io.quarkus.smallrye.jwt".level=TRACE
  8. quarkus.log.category."io.undertow.request.security".level=TRACE

Supported Logging APIs

Applications and components may use any of the following APIs for logging, and the logs will be merged:


1. Some extensions may define customized default log levels for certain categories, in order to reduce log noise by default. Setting the log level in configuration will override any extension-defined log levels.

2. Format sequences which examine caller information may affect performance