> ## 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_query_* session settings

> ClickHouse session settings in the log_query_* generated group.

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>Type</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Default</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Changeable without restart
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

These settings are available in [system.settings](/docs/reference/system-tables/settings) and are autogenerated from [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

<h2 id="log_query_settings">
  log\_query\_settings
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Log query settings into the query\_log and OpenTelemetry span log.

<h2 id="log_query_threads">
  log\_query\_threads
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Setting up query threads logging.

Query threads log into the [system.query\_thread\_log](/docs/reference/system-tables/query_thread_log) table. This setting has effect only when [log\_queries](/docs/reference/settings/session-settings/log-queries#log_queries) is true. Queries' threads run by ClickHouse with this setup are logged according to the rules in the [query\_thread\_log](/docs/reference/settings/server-settings/settings#query_thread_log) server configuration parameter.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

**Example**

```text theme={null}
log_query_threads=1
```

<h2 id="log_query_views">
  log\_query\_views
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Setting up query views logging.

When a query run by ClickHouse with this setting enabled has associated views (materialized or live views), they are logged in the [query\_views\_log](/docs/reference/settings/server-settings/settings#query_views_log) server configuration parameter.

Example:

```text theme={null}
log_query_views=1
```
