---
schema_version: "1"
id: 5b7c3c19b16798df375bf69e1c5c4bab45f37b2f900734d33ad7ed18d51ee64e
title: apex tail log
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/apex/cli_reference_apex_tail_log.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_apex_tail_log.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fffcd6e8b6b8f85d10f99d31798fee9814b45a25ece0bf0de7a940541101cbf1
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# apex tail log

Activate debug logging and display logs in the terminal.

## Description for apex tail log

You can also pipe the logs to a file.

## Aliases for apex tail log

`force:apex:log:tail`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;color</code> | <code>&#8209;c</code> | **Type:** Boolean<br><br>Apply default colors to noteworthy log lines. |
| <code>&#8209;&#8209;debug&#8209;level</code> | <code>&#8209;d</code> | **Type:** Value<br><br>Debug level to set on the DEVELOPER_LOG trace flag for your user. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;skip&#8209;trace&#8209;flag</code> | <code>&#8209;s</code> | **Type:** Boolean<br><br>Skip trace flag setup. Assumes that a trace flag and debug level are fully set up. |
| <code>&#8209;&#8209;target&#8209;org</code> | <code>&#8209;o</code> | **Type:** Value<br>**Required**<br><br>Username or alias of the target org. Not required if the `target-org` configuration variable is already set. |

## Examples for apex tail log

Activate debug logging:

```shell
sf apex tail log
```

Specify a debug level:

```shell
sf apex tail log --debug-level MyDebugLevel
```

Skip the trace flag setup and apply default colors:

```shell
sf apex tail log --color --skip-trace-flag
```
<!-- prettier-ignore-end -->
