> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/solution-editor/actions/data-store/log.md).

# ログアクション

## 概要

ログアクションは、以下の2つのユースケースで活用できるアクションです。

* 任意の文字列、変数などをデバッグするために利用する
* エンドユーザー向けのログメッセージを、ソリューションの実行履歴に表示する

## デバッグに利用する

<figure><img src="https://files.readme.io/f9473fa-Screen_Shot_2023-03-20_at_5.57.03_PM.png" alt=""><figcaption></figcaption></figure>

下記のようなソリューションを構築した場合に、テスト実行画面では以下のような出力が確認できます。

<figure><img src="https://files.readme.io/70c6d99-Screen_Shot_2023-03-20_at_5.56.35_PM.png" alt=""><figcaption></figcaption></figure>

変数の中身を詳細に確認したい場合やFormulaの結果を出力する際に活用できます。

{% hint style="success" %}

### ヒント

ログでの出力は、変数の型に関係なくString型に変換されて出力されます。

ただしFile型などの一部の変数では変換ができない場合があり、その場合は[Formula](/solution-editor/common-specs/formula.md)の`str()関数`を利用することでログ出力を行ってください。
{% endhint %}

<figure><img src="https://files.readme.io/1931b7f-image.png" alt="Google Drive から取得したFile型の変数をstr()して出力する" width="600"><figcaption><p>Google Drive から取得したFile型の変数をstr()して出力する</p></figcaption></figure>

<br>

## エンドユーザーにログメッセージを表示する

ログアクションで出力されたログは、ウィザード内の「ソリューション実行履歴」にも表示され、エンドユーザーも確認できます。ソリューションの実行履歴の詳細については、[こちら](https://anyflow.readme.io/docs/%E3%82%A8%E3%83%B3%E3%83%89%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E5%81%B4%E3%81%A7-%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%AB%E3%81%AA%E3%81%A3%E3%81%9F%E9%80%A3%E6%90%BA%E3%82%BD%E3%83%AA%E3%83%A5%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%82%92%E5%86%8D%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B)を参照してください。

以下のソリューションでは3つのログを出力しており、それが実行履歴に表示されていることがわかります。

<figure><img src="https://files.readme.io/5b7910c-image.png" alt="ソリューションの設定内容"><figcaption><p>ソリューションの設定内容</p></figcaption></figure>

<figure><img src="https://files.readme.io/9a5bdc7-image.png" alt="実行履歴からエンドユーザーも確認できる"><figcaption><p>実行履歴からエンドユーザーも確認できる</p></figcaption></figure>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/solution-editor/actions/data-store/log.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
