keycloak/docs/guides/server/logging/file.adoc
Martin Bartoš b807a45091
Divide logging guide to sub-guides for every log handler (#43132)
* Divide logging guide to sub-guides for every log handler

Closes #43125

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Ability to set level offset to guides, remove emojis

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Add all relevant options to the logging guide

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/file.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/syslog.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/syslog.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/syslog.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/syslog.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/console.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Update docs/guides/server/logging/console.adoc

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Improve link to other section

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

---------

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
2025-10-17 16:37:48 +02:00

56 lines
2 KiB
Text

<#import "/templates/guide.adoc" as tmpl>
<#import "/templates/kc.adoc" as kc>
<#import "/templates/links.adoc" as links>
<#import "/templates/profile.adoc" as profile>
<#import "/templates/options.adoc" as opts>
<@tmpl.guide
title="File logging"
summary="Store logs into a file"
tileVisible="false"
levelOffset=2 >
As an alternative to logging to the console, you can use structured/unstructured logging to a file stored in the filesystem.
The more specific file handler configuration mentioned below will only take effect when the file logging is enabled.
== Enable file logging
Logging to a file is disabled by default. To enable it, enter the following command:
<@kc.start parameters="--log=\"console,file\""/>
A log file named `keycloak.log` is created inside the `data/log` directory of your {project_name} installation.
== Configuring the location and name of the log file
To change where the log file is created and the file name, perform these steps:
. Create a writable directory to store the log file.
+
If the directory is not writable, {project_name} starts correctly, but it issues an error and no log file is created.
. Enter this command:
+
<@kc.start parameters="--log=\"console,file\" --log-file=<path-to>/<your-file.log>"/>
== Configuring the file handler format
To configure a different logging format for the file log handler, enter the following command:
<@kc.start parameters="--log-file-format=\"<pattern>\""/>
See <<Configuring the console log format>> for more information and a table of the available pattern configuration.
== Configuring the file log level
Log level for file log handler can be specified by `--log-file-level` property as follows:
<@kc.start parameters="--log-file-level=warn"/>
For more information, see <<Specify log level for each handler>>.
<@opts.printRelevantOptions includedOptions="log-file-*" excludedOptions="log-file-async*">
== Asynchronous
<@opts.includeOptions includedOptions="log-file-async*"/>
</@opts.printRelevantOptions>
</@tmpl.guide>