# Logging configuration

Snow Owl uses [SLF4J](https://www.slf4j.org/) and [Logback](https://logback.qos.ch/) for logging.

The logging configuration file (`serviceability.xml`) can be used to configure Snow Owl logging. The logging configuration file location depends on your installation method, by default it is located in the `${SO_HOME}/configuration` folder.

Extensive information on how to customize logging and all the supported appenders can be found on the [Logback documentation](https://logback.qos.ch/manual/configuration.html).

### Logstash encoding

Snow Owl supports the generation of structured application logs via the [Logstash encoder](https://github.com/logfellow/logstash-logback-encoder/).

To enable it uncomment the example snippet provided in the console appender section in the `configuration/serviceability.xml` file or copy and paste it from here:

```xml
...
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <timestamp>
                    <fieldName>timestamp</fieldName>
                    <timeZone>UTC</timeZone>
                </timestamp>
                <loggerName>
                    <fieldName>logger</fieldName>
                </loggerName>
                <logLevel>
                    <fieldName>level</fieldName>
                </logLevel>
                <threadName>
                    <fieldName>thread</fieldName>
                </threadName>
                <nestedField>
                    <fieldName>mdc</fieldName>
                    <providers>
                        <mdc />
                    </providers>
                </nestedField>
                <stackTrace>
                    <fieldName>stackTrace</fieldName>
                    <throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
                        <maxDepthPerThrowable>200</maxDepthPerThrowable>
                        <maxLength>14000</maxLength>
                        <rootCauseFirst>true</rootCauseFirst>
                    </throwableConverter>
                </stackTrace>
                <message />
                <throwableClassName>
                    <fieldName>exceptionClass</fieldName>
                </throwableClassName>
            </providers>
	</encoder>
</appender>
...
```

For additional config options visit the Logstash encoder GitHub page or [this site](https://learn.microsoft.com/en-us/azure/spring-apps/basic-standard/structured-app-log#log-with-logback).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.b2ihealthcare.com/snow-owl/9.x/setup-and-administration/advanced-configuration/logging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
