# log_min_error_statement

> Also log the SQL text of every statement that raises an error at this severity or higher.

Source: https://sqlly.app/sql-configuration/postgresql/log-min-error-statement
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`error`

**Range**

debug5, debug4, debug3, debug2, debug1, info, notice, warning, error, log, fatal, panic

**Restart needed**

No

**Default checked on**

PostgreSQL 18

## What it does

The counterpart of log_min_duration_statement, which logs slow statements that succeed. At the default, statements causing ERROR, LOG, FATAL or PANIC are logged with their text; set PANIC to stop logging failing statements entirely.

## Default value

`error`. error (PostgreSQL 18).

## Check the current value

```
SHOW log_min_error_statement;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'log_min_error_statement';
```

## Change it

```
SET log_min_error_statement = warning;   -- this session

ALTER SYSTEM SET log_min_error_statement = warning;
SELECT pg_reload_conf();
```

No restart. Superusers, or roles granted SET on the parameter (PostgreSQL 15 and later), can SET it per session; a server-wide ALTER SYSTEM change applies after a reload (context is superuser).

## When to change it

Raise it to warning or notice while hunting an application error whose SQL you need to see; lower it to panic only on high-volume systems where the application handles errors and logs them itself.

## What can go wrong

Every logged statement carries its full text with parameter values filled in, so errors on tables with personal data put that data in the log. The debug levels on a busy server can produce a log line for most statements the application runs.

## Questions about log_min_error_statement

### What is the default value of log_min_error_statement in PostgreSQL?

error. error (PostgreSQL 18).

### Does changing log_min_error_statement require a restart?

No. No restart. Superusers, or roles granted SET on the parameter (PostgreSQL 15 and later), can SET it per session; a server-wide ALTER SYSTEM change applies after a reload (context is superuser).

### When should I change log_min_error_statement?

Raise it to warning or notice while hunting an application error whose SQL you need to see; lower it to panic only on high-volume systems where the application handles errors and logs them itself.

Back to all [PostgreSQL settings](https://sqlly.app/sql-configuration/postgresql), or check the [PostgreSQL manual](https://www.postgresql.org/docs/current/runtime-config.html) for every option.

## Related PostgreSQL settings

- [`log_min_duration_statement` Log every statement that runs at least this long; -1 disables, 0 logs everything.](https://sqlly.app/sql-configuration/postgresql/log-min-duration-statement)
- [`log_lock_waits` Log a message when a session waits longer than deadlock_timeout for a lock.](https://sqlly.app/sql-configuration/postgresql/log-lock-waits)
