# Log Tap

Use a Log Tap node in your Flow to send log messages to the Flow Editor [Debug](https://docs.contextual.io/documentation-and-resources/components-and-data/flows/node-red-flow-editor/in-flow-testing-with-debugger) sidebar, and to [Agent Logs](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/agent-details/logs), with varying levels of detail based on your development needs and operational preferences. The TTL for all log messages in your Contextual tenant, is 24 hours.

#### Basic Node Usage Example

{% @mermaid/diagram content="flowchart LR
A\["Event Start"] --> B("Code Step 1")
B --> C("Log Tap 1")
C --> D("Code Step 2")
D --> E("Log Tap 2")
E --> F\["Event End"]
style A fill:#FFFFFF,stroke:#000000
style B fill:#FFFFFF,stroke:#000000
style C stroke:#00C853,color:#FFFFFF,fill:#00C853
style D fill:#FFFFFF,stroke:#000000
style E fill:#00C853,stroke:#00C853,color:#FFFFFF
style F fill:#FFFFFF,stroke:#000000" %}

By adding a Log Tap node in between key operations in your Flow, log messages will be written containing important information about the status of operation of the Flow, at that point, based on the configuration of the Log Tap node itself.

#### Configuring a Log Tap Node

To configure a Log Tap node in the [Flow Editor](https://docs.contextual.io/documentation-and-resources/components-and-data/flows/node-red-flow-editor), drag it from the Palette to the Workspace canvas, then double-click the node to open and configure its behavior.

<figure><img src="https://2803907488-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJF7AoTYz7NHacejws5p9%2Fuploads%2Fgit-blob-2df3ff05af46db20fb8f9cd049bcccf076e3030e%2Fimage.png?alt=media" alt="Example of settings for a Log Tap node"><figcaption><p>Example of settings for a Log Tap node</p></figcaption></figure>

1. Provide an optional **Name** for the node.
   * By default a Log Tap node will be shown with a label of "log tap", but the value you provide in the Name field will replace it in the Flow Editor UI making your flow easier to read and understand.
   * This value will also be included in the Flow Editor [Debug Panel](https://docs.contextual.io/documentation-and-resources/components-and-data/flows/node-red-flow-editor/in-flow-testing-with-debugger), as well as in [Agent Logging](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/agent-details/logs), to help find and understand log messages.
2. Choose the desired detail of logging for **Output**.
   * *msg.* - <mark style="background-color:red;">note</mark>
   * *complete message object* - <mark style="background-color:red;">note</mark>
   * *expression* - <mark style="background-color:red;">note</mark>
3. Choose the desired level for the log message, using **Log Level**. <mark style="background-color:red;">Log Tap nodes will generate messages based on the</mark> [<mark style="background-color:red;">Agent Log Level</mark>](https://docs.contextual.io/documentation-and-resources/getting-started/readme) <mark style="background-color:red;">setting of any Agent that sends events to your flow, a setting which can be changed at any time without restarting the agent.</mark>
   * *debug* - typically used for logging messages with a high level level of detail, useful during software development and debugging. Debug logs are typically not enabled in a production environment unless troubleshooting a specific issue due to the high volume of log output that can be generated.
   * *info* - typically used for informational messages that highlight the progress of an application at a coarse-grain level. Info logs are typically enabled in a production environment to provide a general sense of application activity without being too verbose.
   * *warn* - typically used to indicate there is a potential issue or a situation that could lead to a problem in the future, but the application is running as expected. Warn logs are typically always enabled.
   * *error* - typically used to log error events that might still allow the application to continue running. Error logging usually captures events that are not fatal but significant. Error logs are always enabled.
4. Select **Send to Console** to collect the log message as part of [Agent Logs](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/agent-details/logs). If this option is not selected, log messages will not be available in Agent Logs.
5. Select **Send to Sidebar** to display the log message in the Flow Editor Debug sidebar, which is specifically useful for [in-flow testing with the debugger](https://docs.contextual.io/documentation-and-resources/components-and-data/flows/node-red-flow-editor/in-flow-testing-with-debugger), allowing you to quickly test and observe many aspects of your flow development, without requiring an Agent restart for quick testing and validation.
