---
title: "Logging: Overview"
description: "Configure and analyze RavenDB server logs with adjustable log levels, structured output, and real-time log streaming for diagnostics."
url: "https://docs.ravendb.net/7.2/monitoring/logging/overview"
version: "7.2"
---

# Logging: Overview

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

## Logging: Overview

> **Note**
>
> - **Multiple logging levels**  
>   RavenDB provides a flexible logging system that lets you control the volume and detail of logged information
>   by selecting the most suitable level from a [scale of six logging levels](#available-logging-levels).
>
>   For example, the *Trace* level captures all events, transactions, and database changes, producing logs that can be processed for auditing or detailed analysis,
>   while *Warning* level limits output to warnings and errors to help keep logs focused and readable even in large or complex systems.
>
> - **Numerous logging destinations**  
>   Starting with RavenDB version `7.0`, RavenDB outputs all log data through [NLog](https://nlog-project.org), a widely used `.NET` logging framework
>   capable of streaming logged data to various destinations using a large number of available [NLog plugins](https://nlog-project.org/config/).
>
> - **High performance**  
>   Because logging is asynchronous and is handled by a thread dedicated to I/O operations, it has minimal effect on server performance.
>
> - In this article:
>   - [Available logging destinations](#available-logging-destinations)
>   - [Logging configuration](#logging-configuration)
>   - [Available logging levels](#available-logging-levels)
>     - [Customizing logging level after migration](#customizing-logging-level-after-migration)
>   - [Default values](#default-values)
>   - [Microsoft logs](#microsoft-logs)
>   - [CLI customization: immediate temporary changes](#cli-customization-immediate-temporary-changes)
>   - [Configuring and using NLog](#configuring-and-using-nlog)
>     - [Configure RavenDB to use an external NLog configuration file](#1-configure-ravendb-to-use-an-external-nlog-configuration-file)
>     - [Configure RavenDB to use NLog plugins that stream log data](#2-configure-ravendb-to-use-nlog-plugins-that-stream-log-data)
>     - [Set your NLog configuration file](#3-set-your-nlog-configuration-file)
>       - [An available template](#an-available-template)
>       - [Mandatory `logger` definitions](#mandatory-logger-definitions)
>       - [Your own loggers](#your-own-loggers)
>   - [Studio: the Admin Logs view](#studio-the-admin-logs-view)

## Available logging destinations {#available-logging-destinations}

RavenDB versions up to `6.2` write log data to files on the server machine, and can optionally
stream this data to the server console.

Starting with version 7.0, RavenDB integrates the [NLog](https://nlog-project.org) logging framework.  
The logging process has hardly changed, but the integration with NLog now allows RavenDB to log
more versatile data to many additional destinations via [NLog plugins](https://nlog-project.org/config/).  
Available logging destinations include, among others, log aggregators like
[Grafana Loki](https://grafana.com/oss/loki/) and [Splunk](https://en.wikipedia.org/wiki/Splunk),
filtering and error handling tools, and a long list of applications that NLog is integrated with.

## Logging configuration {#logging-configuration}

- By default, RavenDB uses **internal configuration keys** to adjust logging.  
  Using this method, you can only output data to log files and to the server console.  
  Up to version `6.2`, this is the only available way to customize logging.

  > **Note**
  >
  > - See a [list of logging configuration keys](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md).
  > - Learn to modify the [configuration keys](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md).

- If you want to utilize **NLog plugins** so you can output log data to additional destinations,  
  you must use an **external NLog configuration** file.
  - Changing logging settings using an external configuration file is available from RavenDB version `7.0` on,
    as part of RavenDB's NLog integration.
  - Once an external configuration file is applied, its settings override all the values set by internal configuration keys.
  - To set an external configuration file, see [Configuring and using NLog](#configuring-and-using-nlog).

- To **determine whether to use an NLog configuration file or internal configuration keys**,  
  set the [Logs.ConfigPath](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsconfigpath) configuration key with -
  - a [path](#1-configure-ravendb-to-use-an-external-nlog-configuration-file) to the configuration file you want to apply
  - or `null` to continue using internal configuration keys.

---

> **Info:** Applying changes {#applying-changes}
>
> - **Permanent changes** to the logging configuration, through either configuration keys or an external configuration file, take effect only after restarting the server.
>
> - **Temporary changes** can be applied at runtime, without requiring a server restart, using:
>   - the [CLI](#cli-customization-immediate-temporary-changes)
>   - Studio's [Admin Logs view](https://docs.ravendb.net/7.2/monitoring/logging/admin-logs.md)
>   - the Client API [`SetLogsConfigurationOperation`](https://docs.ravendb.net/7.2/monitoring/logging/client-api.md#change-the-logging-configuration-at-runtime) method
>
> - The *scope* of all logging settings is *server-wide*, applying to all databases.

## Available logging levels {#available-logging-levels}

Starting with version `7.0`, RavenDB uses a new set of logging levels that differ from those in previous versions.

### Logging modes (used in versions prior to 7.0)

RavenDB versions up to `6.2` use a proprietary set of **logging modes**.

| Logging Mode | Description |
| - | - |
| `Operations` | High-level info for operational use |
| `Information` | Low-level debug info |
| `None` | Logging is disabled |

### NLog-compliant logging levels (version 7.0 and above)

Starting with version `7.0`, RavenDB uses NLog-compliant **logging levels**.

| Logging Level | Description |
| - | - |
| `Trace` | A highly informative level that's mostly used only during development |
| `Debug` | Debug information reported by internal application processes |
| `Info` | Information related to application progress, events lifespan, etc. |
| `Warn` | Warnings returned by failed validations, mild, recoverable failures, etc. |
| `Error` | Error reports of functionality failures, caught exceptions, etc. |
| `Fatal` | Fatal failures |
| `Off` | Logging is disabled |

### Customizing logging level after migration

When migrating from an older version to `7.0` or higher, RavenDB can interpret the old
*logging mode* configuration and translate it to the equivalent *NLog level*.

| **Logging mode (RavenDB ≤ `6.2`)** | **Equivalent NLog level (RavenDB ≥ `7.0`)** |
| - | - |
| Operations | Info |
| Information | Debug |

Logging will therefore continue uninterrupted; there is no rush to modify the logging level right after migration.  
You **will** need to update the logging settings if you want to take advantage of NLog features.

To use an NLog logging level such as `Warn`, update [`settings.json`](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md#settingsjson):

```json
...
"Logs.MinLevel": "Warn",
...
```

To output log data to a destination such as a log aggregation tool using an NLog plugin, apply an
[NLog configuration file](#configuring-and-using-nlog) and configure in it any
NLog-specific settings, including the logging level:

```xml
<rules>
...
<logger ruleName="log_aggregator_1"
        name="*" minlevel="Warn" writeTo="agg" />
...
</rules>
```

## Default values {#default-values}

### Default logging level

The default minimum logging level is `LogLevel.Info`.  
To use a different level, set the [Logs.MinLevel](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsminlevel) configuration key.

### Default destination

Log entries are written by default to log files in the **Logs** folder on the server machine.  
To store log files in a different path, set the [Logs.Path](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logspath) configuration key.  
Learn how to log to additional destinations in [Configuring and using NLog](#configuring-and-using-nlog).

### Default time standard

The default time standard used for log entries is `UTC`.  
Changing this configuration is available only using the NLog configuration file:

```text
layout="${longdate:universalTime=true}..."
```

### NLog configuration file defaults

The default values provided for settings in the [NLog configuration file template](#an-available-template)
are **identical** to those used by RavenDB's internal configuration keys.  
See the full list of keys and their default values in the [logging configuration keys](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md) page.

## Microsoft logs {#microsoft-logs}

Beyond its own log entries, RavenDB can capture the diagnostic logs that .NET and Kestrel
(RavenDB's web server) emit internally.  
These entries come from the `Microsoft.Extensions.Logging` infrastructure and cover events such as
ASP.NET Core hosting, Kestrel connections, and the start and finish of each request.  
They can help you investigate connection-level or HTTP-level behavior that RavenDB's own logs do not describe.

These entries are collectively called **Microsoft logs**, and are disabled by default.  
Capturing them can affect request latency under certain conditions, so enable them only when you need them,
typically while diagnosing a specific problem.

To enable Microsoft logs, set the following configuration keys and restart the server:

- [Logs.Microsoft.Enabled](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsmicrosoftenabled)  
  Set to `true` to capture Microsoft logs.
- [Logs.Microsoft.MinLevel](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsmicrosoftminlevel)  
  Set the minimum level of the Microsoft entries that are logged. The default is `Error`.

> **Note**
>
> Once Microsoft logs are enabled, you can adjust their minimum level at runtime, without restarting the server,
> using the Client API [`SetLogsConfigurationOperation`](https://docs.ravendb.net/7.2/monitoring/logging/client-api.md#change-the-logging-configuration-at-runtime) method.

## CLI customization: immediate temporary changes {#cli-customization-immediate-temporary-changes}

Logging settings can also be customized via the [CLI](https://docs.ravendb.net/7.2/server/administration/cli.md), using the [log](https://docs.ravendb.net/7.2/server/administration/cli.md#log) command.  
Unlike the permanent customization methods described above (via internal configuration keys or an external NLog file),
which require a server restart to take effect, changes made using the CLI take effect **immediately**.

However, these changes are temporary: they are overridden when the server restarts and reloads the persistent configuration
from [settings.json](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md#settingsjson) or the NLog configuration file.

Use the following syntax to customize logging via the CLI:

```text
log [on|off] [http-]<on|off> [info|debug] [no-console]
```

#### Example:

To temporarily change the logging level to `debug`, issue the following command in the server console:

```text
ravendb> log debug
```

## Configuring and using NLog {#configuring-and-using-nlog}

To use NLog you need to:

1. [Configure RavenDB to use an external NLog configuration file](#1-configure-ravendb-to-use-an-external-nlog-configuration-file)
2. [Configure RavenDB to use NLog plugins that stream log data](#2-configure-ravendb-to-use-nlog-plugins-that-stream-log-data)
3. [Set your NLog configuration file](#3-set-your-nlog-configuration-file)

### 1. Configure RavenDB to use an external NLog configuration file

NLog options are customized using an NLog configuration file.
To use a custom file, set the [Logs.ConfigPath](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsconfigpath) configuration key to the full path of your NLog configuration file.

#### Example:

To use a configuration file named `NLog.config` located in the RavenDB server directory, add the following line to [`settings.json`](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md#settingsjson):

```json
...
"Logs.ConfigPath": "NLog.config",
...
```

> **Info**
>
> - Learn how to set configuration keys [here](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md).
> - Learn how to create and modify an NLog configuration file [below](#3-set-your-nlog-configuration-file).
> - Note: once a configuration file is used, the logging settings defined in it override all [internal configuration keys](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md) values.

### 2. Configure RavenDB to use NLog plugins that stream log data

NLog's biggest advantage lies in its [plugins library](https://nlog-project.org/config/), which allows applications like RavenDB to stream log data to a wide range of destinations.

NLog plugins are distributed as NuGet packages, and you can instruct RavenDB to download and load them during startup.
To do this, define the plugin's NuGet package URL as a property of the [Logs.NuGet.AdditionalPackages](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsnugetadditionalpackages)
configuration key, with the plugin version as its value.

#### Example:

To load a [Grafana Loki](https://grafana.com/oss/loki/) plugin, add an `NLog.Targets.Loki` property to RavenDB's `Logs.NuGet.AdditionalPackages` configuration key, with the desired plugin version as its value.

```json
...
"Logs.NuGet.AdditionalPackages": { "NLog.Targets.Loki": "3.3.0" },
...
```

> **Info:** Other NuGet-related configuration keys
>
> - [Logs.NuGet.PackagesPath](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsnugetpackagespath)  
>   Use this key to specify the path where NuGet packages required by RavenDB are downloaded.
> - [Logs.NuGet.PackageSourceUrl](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsnugetpackagesourceurl)  
>   Use this key to set the default URL for the NuGet package source.
> - [Logs.NuGet.AllowPreReleasePackages](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsnugetallowprereleasepackages)  
>   Use this key to determine whether RavenDB is allowed to install pre-release versions of NuGet packages.
> - [Logs.NuGet.AdditionalPackages](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsnugetadditionalpackages)  
>   Use this key to specify a dictionary of additional NuGet packages to load during server startup for logging.  
>   Each key is a package name, and the corresponding value is the desired version.

### 3. Set your NLog configuration file

Follow the procedure below to create and modify an NLog configuration file.
When you're done, restart the server to apply the new settings.

#### An available template:

We've created an NLog configuration file **template** for your convenience,
it is available in the RavenDB **server** folder under the name `NLog.template.config`.  
You can copy the template and modify it to suit your needs, or use your own configuration file if you prefer.

#### Mandatory `logger` definitions:

Whether you base your configuration file on our template or use your own file,
make sure it includes the four *logger* entries defined in the template's **rules** section.
These definitions are mandatory; failing to include them will generate an exception at startup.

```xml
<rules>
    <!--These loggers are mandatory-->
    <logger ruleName="Raven_System"
        name="System.*" finalMinLevel="Warn" />
    <logger ruleName="Raven_Microsoft"
        name="Microsoft.*" finalMinLevel="Warn" />
    <logger ruleName="Raven_Default_Audit"
        name="Audit" levels="Info" final="true" />
    <logger ruleName="Raven_Default"
        name="*" levels="Info,Warn,Error,Fatal" writeTo="Raven_Default_Target" />
</rules>
```

#### Your own loggers:

The `Raven_Default` logger, for example, directs log entries to `Raven_Default_Target`.  
Looking at the **Raven\_Default\_Target** definition (also included in the template file)
you'll see that it outputs log data to files in the server's **Logs** folder.

```xml
<target xsi:type="AsyncWrapper" name="Raven_Default_Target">
  <target
    name="FileTarget"
    xsi:type="File"
    createDirs="true"
    fileName="${basedir}/Logs/${shortdate}.log"
    archiveNumbering="DateAndSequence"
    header="Date|Level|ThreadID|Resource|Component|Logger|Message|Data"
    layout="${longdate:universalTime=true}|${level:uppercase=true}|${threadid}|
            ${event-properties:item=Resource}|${event-properties:item=Component}|
            ${logger}|${message:withexception=true}|${event-properties:item=Data}"
    footer="Date|Level|Resource|Component|Logger|Message|Data"
    concurrentWrites="false"
    writeFooterOnArchivingOnly="true"
    archiveAboveSize="134217728"
    enableArchiveFileCompression="true" />
</target>
```

To output log data through an NLog plugin (instead of writing to log files), you can either keep the default logger and modify its target, or define your own logger and target for the plugin.

For example, to utilize a pre-installed `Loki` plugin, add a new logger:

```xml
<logger ruleName="Grafana_Loki"
        name="*" levels="Info,Warn,Error,Fatal" writeTo="loki" />
```

Then add a new `loki` target for this logger, specifying the properties required to connect and the log data layout for this destination:

```xml
<target
    name="loki"
    xsi:type="loki"
    endpoint="https://your_end_point.net"
    username="${your_user_name}"
    password="${your_token}"
    layout="${longdate:universalTime=true}|${level:uppercase=true}|${threadid}|
            ${event-properties:item=Resource}|${event-properties:item=Component}|
            ${logger}|${message:withexception=true}|${event-properties:item=Data}">
<label name="app" layout="layout" />
</target>
```

> **Info**
>
> For a complete guide to integrating RavenDB logs with **Grafana Cloud** using **NLog and Loki**,
> see [Sending Your RavenDB Logs to Grafana Cloud](https://docs.ravendb.net/guides/sending-your-ravendb-7-0-logs-to-grafana-cloud.md).

## Studio: the Admin Logs view {#studio-the-admin-logs-view}

The log messages generated by the server can be viewed in real time from within Studio's [Admin Logs view](https://docs.ravendb.net/7.2/monitoring/logging/admin-logs.md).  
This view provides the following capabilities:

- Displays a continuous stream of RavenDB log entries in real time.
- Allows you to define the settings that determine the log entries written to disk.
