# 18.12. 在 Windows 註冊事件日誌

要在作業系統註冊 Windows 事件日誌，請使用以下指令：

```
regsvr32 pgsql_library_directory/pgevent.dll
```

這將建立事件檢視器使用的註冊機碼項目，該項目由名為 PostgreSQL 的預設事件來源建立。

要指定不同的事件來源名稱（請參閱 [event\_source](/server-administration/server-configuration/error-reporting-and-logging.md#event_source-string)），請使用 /n 和 /i 選項：

```
regsvr32 /n /i:event_source_name pgsql_library_directory/pgevent.dll
```

要從作業系統註銷事件日誌，請使用以下指令：

```
regsvr32 /u [/i:event_source_name] pgsql_library_directory/pgevent.dll
```

#### 注意

要在資料庫伺服器中啟用事件日誌記錄，請修改 postgresql.conf 中的 [log\_destination ](/server-administration/server-configuration/error-reporting-and-logging.md#log_destination-string)，使其包含 eventlog。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/server-administration/server-setup-and-operation/18.11.-zai-windows-zhu-ce-shi-jian-ri-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
