> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# log_* 会话设置

> 按 log_* 生成的分组中的 ClickHouse 会话设置。

这些设置可在 [system.settings](https://clickhouse.com/docs/zh/reference/system-tables/settings.md) 中找到，并由 [源文件](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

## log\_comment

指定 [system.query\_log](https://clickhouse.com/docs/zh/reference/system-tables/query_log.md) 表中 `log_comment` 字段的值，以及服务器日志中的注释文本。

它可用于提高服务器日志的可读性。此外，在运行 [clickhouse-test](https://clickhouse.com/docs/zh/resources/develop-contribute/contribute/tests.md) 后，它还有助于从 `system.query_log` 中筛选与测试相关的查询。

可能的值：

* 不超过 [max\_query\_size](https://clickhouse.com/docs/zh/reference/settings/session-settings/max.md#max_query_size) 的任意字符串。如果超过 max\_query\_size，服务器会抛出异常。

**示例**

查询：

```sql theme={null}
SET log_comment = 'log_comment test', log_queries = 1;
SELECT 1;
SYSTEM FLUSH LOGS;
SELECT type, query FROM system.query_log WHERE log_comment = 'log_comment test' AND event_date >= yesterday() ORDER BY event_time DESC LIMIT 2;
```

结果：

```text theme={null}
┌─type────────┬─query─────┐
│ QueryStart  │ SELECT 1; │
│ QueryFinish │ SELECT 1; │
└─────────────┴───────────┘
```

## log\_formatted\_queries

类型

Bool

默认值

0

允许将格式化后的查询记录到 [system.query\_log](https://clickhouse.com/docs/zh/reference/system-tables/query_log.md) 系统表中 (即填充 [system.query\_log](https://clickhouse.com/docs/zh/reference/system-tables/query_log.md) 中的 `formatted_query` 列) 。

可能的值：

* 0 — 不会将格式化后的查询记录到系统表中。
* 1 — 会将格式化后的查询记录到系统表中。

## log\_processors\_profiles

类型

Bool

默认值

1

将处理器在执行过程中以及等待数据时耗费的时间写入 `system.processors_profile_log` 表。

另请参见：

* [`system.processors_profile_log`](https://clickhouse.com/docs/zh/reference/system-tables/processors_profile_log)
* [`EXPLAIN PIPELINE`](https://clickhouse.com/docs/zh/reference/statements/explain#explain-pipeline)

## log\_profile\_events

类型

Bool

默认值

1

将查询性能统计信息写入 query\_log、query\_thread\_log 和 query\_views\_log。
