Quarkus Logging JSON

Quarkus logging extension outputting the logging in JSON.

Installation

If you want to use this extension, you need to add the quarkus-logging-json extension first. In your pom.xml file, add:

<dependency>
    <groupId>io.quarkiverse.loggingjson</groupId>
    <artifactId>quarkus-logging-json</artifactId>
    <version>3.1.0</version>
</dependency>

Extension Configuration Reference

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

Determine whether to enable the JSON console formatting extension, which disables "normal" console formatting.

Environment variable: QUARKUS_LOG_JSON_CONSOLE_ENABLE

boolean

true

Determine whether to enable the JSON file formatting extension, which disables "normal" file formatting.

Environment variable: QUARKUS_LOG_JSON_FILE_ENABLE

boolean

false

Used to wrap arguments in an json object, with this fieldName on root json.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ARGUMENTS_FIELD_NAME

string

Enable output of structured logging arguments StructuredArgument, default is true.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ARGUMENTS_INCLUDE_STRUCTURED_ARGUMENTS

boolean

true

Enable output of non structured logging arguments, default is false.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ARGUMENTS_INCLUDE_NON_STRUCTURED_ARGUMENTS

boolean

false

What prefix to use, when outputting non structured arguments. Default is arg, example key for first argument will be arg0.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ARGUMENTS_NON_STRUCTURED_ARGUMENTS_FIELD_PREFIX

string

arg

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_TIMESTAMP_FIELD_NAME

string

The date format to use. The special string "default" indicates that the default format should be used.

Environment variable: QUARKUS_LOG_JSON_FIELDS_TIMESTAMP_DATE_FORMAT

string

default

The zone to use when formatting the timestamp.

Environment variable: QUARKUS_LOG_JSON_FIELDS_TIMESTAMP_ZONE_ID

string

default

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_TIMESTAMP_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_HOSTNAME_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_HOSTNAME_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_SEQUENCE_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_SEQUENCE_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LOGGER_CLASS_NAME_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LOGGER_CLASS_NAME_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LOGGER_NAME_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LOGGER_NAME_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LEVEL_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_LEVEL_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_MESSAGE_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_MESSAGE_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_THREAD_NAME_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_THREAD_NAME_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_THREAD_ID_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_THREAD_ID_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_MDC_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_MDC_ENABLED

boolean

Will write the values at the top level of the JSON log object.

Environment variable: QUARKUS_LOG_JSON_FIELDS_MDC_FLAT_FIELDS

boolean

false

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_NDC_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_NDC_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_PROCESS_NAME_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_PROCESS_NAME_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_PROCESS_ID_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_PROCESS_ID_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_STACK_TRACE_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_STACK_TRACE_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ERROR_TYPE_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ERROR_TYPE_ENABLED

boolean

Used to change the json key for the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ERROR_MESSAGE_FIELD_NAME

string

Enable or disable the field.

Environment variable: QUARKUS_LOG_JSON_FIELDS_ERROR_MESSAGE_ENABLED

boolean

Enable "pretty printing" of the JSON record. Note that some JSON parsers will fail to read pretty printed output.

Environment variable: QUARKUS_LOG_JSON_PRETTY_PRINT

boolean

false

The special end-of-record delimiter to be used. By default, newline delimiter is used.

Environment variable: QUARKUS_LOG_JSON_RECORD_DELIMITER

string

` `

Support changing logging format.

Environment variable: QUARKUS_LOG_JSON_LOG_FORMAT

default, ecs

default

For adding fields to the json output directly from the config

Type

Default

Additional field value.

Environment variable: QUARKUS_LOG_JSON_ADDITIONAL_FIELD__FIELD_NAME__VALUE

string

required

Type of the field, default is STRING. Supported types: STRING, INT, LONG, FLOAT, DOUBLE.

Environment variable: QUARKUS_LOG_JSON_ADDITIONAL_FIELD__FIELD_NAME__TYPE

string, int, long, float, double

string