# Database Logging Configuration

Source: https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/database-logging-configuration

This guide provides the exact `.env` file parameters required to set up Database logging. All logging settings are managed directly within your `.env` configuration file.

**Warning: Multi-Instance Deployments**

Do not use Database logging if you are running a Multi-Instance architecture. As your organization scales, the sheer volume of log writing requests from multiple worker nodes can quickly overload and crash the database.



## Step 1. Set the Log Level

To control the volume of diagnostic data generated by the application, set the global verbosity using the `Serilog__MinimumLevel__Default` parameter.

The available levels are `Information`, `Debug`, `Warning`, and `Error`

**Warning: Avoid Debug Mode in Production**

It is **highly recommended** to keep the log level set to `Error`for regular day-to-day operations. You should only change this value to `Debug` if explicitly instructed by Sendent Support to capture detailed diagnostics for bug resolution. The `Debug` level generates a massive amount of data and can quickly consume disk space and degrade performance.



## Step 2. Select the Log Output Destination

The application uses a bitwise mathematical configuration for the `Service__LoggingConfiguration__LogsOutput` parameter. To enable Database output, you must include the value `2`.

```bash
Service__LoggingConfiguration__LogsOutput=2
```

If you wish to combine Database logging with other methods, simply sum their respective values (e.g., `1` for Console + `2` for Database = `3`).

## Step 3. Accessing Your Logs

1. Open a database management tool (e.g., pgAdmin, DBeaver, or SQL Server Management Studio).
2. Connect to your configured database using the credentials from your `.env` file.
3. Query the automatically generated `Logs` table within your `SendentDB` database to view the records.
