[[logging-configuration-migration]]
== Logging configuration migration

Compatibility with the legacy logging system is assured until the end of the `v7` version. 
All log messages handled by `root` context are forwarded to the legacy logging service. If you re-write
root appenders, make sure that it contains `default` appender to provide backward compatibility.

NOTE: When you switch to the new logging configuration, you will start seeing duplicate log entries in both formats. 
These will be removed when the `default` appender is no longer required. If you define an appender for a logger, 
the log messages aren't handled by the `root` logger anymore and are not forwarded to the legacy logging service.

[[logging-pattern-format-old-and-new-example]]
[options="header"]
|===

| Parameter | Platform log record in **pattern** format | Legacy Platform log record **text** format

| @timestamp | ISO8601_TZ `2012-01-31T23:33:22.011-05:00` | Absolute `23:33:22.011`

| logger | `parent.child` | `['parent', 'child']`

| level | `DEBUG` | `['debug']`

| meta | stringified JSON object `{"to": "v8"}`| N/A

| pid | can be configured as `%pid` | N/A

|===

[[logging-json-format-old-and-new-example]]
[options="header"]
|===

| Parameter | Platform log record in **json** format | Legacy Platform log record **json** format

| @timestamp | ISO8601_TZ `2012-01-31T23:33:22.011-05:00` | ISO8601 `2012-01-31T23:33:22.011Z`

| logger | `log.logger: parent.child` | `tags: ['parent', 'child']`

| level | `log.level: DEBUG` | `tags: ['debug']`

| meta | merged in log record  `{... "to": "v8"}` | merged in log record  `{... "to": "v8"}`

| pid | `process.pid: 12345` | `pid: 12345`

| type | N/A | `type: log`

| error | `{ message, name, stack }` | `{ message, name, stack, code, signal }`

|===

[[logging-cli-migration]]
=== Logging configuration via CLI

As is the case for any of Kibana's config settings, you can specify your logging configuration via the CLI. For convenience, the `--verbose` and `--silent` flags exist as shortcuts and will continue to be supported beyond v7.

If you wish to override these flags, you can always do so by passing your preferred logging configuration directly to the CLI. For example, with the following configuration:

[source,yaml]
----
logging:
  appenders:
    custom:
      type: console
      layout:
        type: pattern
        pattern: "[%date][%level] %message"
----

you can override the flags with:

[options="header"]
|===

| legacy logging | {kib} Platform logging | cli shortcuts

|--verbose| --logging.root.level=debug --logging.root.appenders[0]=default --logging.root.appenders[1]=custom | --verbose

|--quiet| --logging.root.level=error --logging.root.appenders[0]=default --logging.root.appenders[1]=custom | not supported

|--silent| --logging.root.level=off | --silent
|===

NOTE: To preserve backwards compatibility, you are required to pass the root `default` appender until the legacy logging system is removed in `v8.0`.
