> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/merchant-tokenization/ja/sdk-tong-he/error-management/retrieve-sdk-logs/ios.md).

# iOS

## セキュアログ <a href="#secure-logs-1" id="secure-logs-1"></a>

Thales SDK を構成してセキュアで難読化されたログファイルを生成します。

### セキュアログの有効化または無効化 <a href="#how-to-enabledisable-secure-logging" id="how-to-enabledisable-secure-logging"></a>

セキュアログはデフォルトで有効です。Thales SDK の初期化時に無効にすることができます：

```swift
let serverUrl;
let serverCertificate;
let keyIdentifier;
let enableSecureLog; //オプション
let configurationBuilder = TMGClientConfiguration.Builder(serverUrl: serverUrl, 
                                                          serverCertificate: Data(serverCertificate.utf8), 
                                                          serverKeyId: keyIdentifier,
                                                          enableSecureLog: false)
```

この例では、 `enableSecureLog` は `false`に設定されています。これは Thales SDK の初期化後のログ生成を無効にします。デフォルト設定（`true`）では、SDK はアプリプロセスのライフタイム中にログを書き込みます。

ログ記録を一時的に一時停止することもできます：

```swift
// ログを一時的に無効化します。
TMGClient.secureLog?.setLevel(.off)
 
// デフォルトのログレベルでログ記録を再開します。
TMGClient.secureLog?.setLevel(.warn)
```

ログレベルを `.off` に設定すると Thales SDK は新しいセキュアログエントリの書き込みを停止します。再開するにはこれを `.warn` （デフォルト）または別のレベルに戻してください。

### セキュアログファイルの取得 <a href="#how-to-retrieve-secure-log-files-1" id="how-to-retrieve-secure-log-files-1"></a>

Thales SDK はアプリケーションサンドボックス内にセキュアログファイルを生成します。次のように取得します：

```swift
if let logFiles: [URL] = TMGClient.secureLog?.files() {
    // ファイルを処理します     
}
```

`logFiles` は配列を含みます `URL` 利用可能なログファイルのオブジェクトです。問題を調査する際にはこれらのファイルを Thales デリバリーチームと共有してください。

## コンソールログ <a href="#console" id="console"></a>

次の `debug` ライブラリを使用してコンソールでログを表示します：

1. Mac で Console アプリを開きます。
2. Console の **アクション** メニューで、次の両方を有効にします `情報メッセージを含める` です。難読化の詳細は、 `デバッグメッセージを含める`.

{% hint style="info" %}
Console.app でログを表示するには、 `Console.app`で、フィルタを `TMGSDK` に設定します **検索** フィールド。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.payments.thalescloud.io/merchant-tokenization/ja/sdk-tong-he/error-management/retrieve-sdk-logs/ios.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.
