---
title: nextflow logfile
description: Reference for the nextflow logfile command. Print the contents of a Nextflow log file.
---

# `nextflow logfile`

<AddedInVersion version="26.10" />

Print the contents of a Nextflow log file, with optional level filtering and follow mode.

## Usage

```console
$ nextflow logfile [options] [run_name | session_id | path]
```

## Description

The `logfile` command prints the contents of a `.nextflow.log` file written by Nextflow during a pipeline run. The argument can be:

- A run name, for example `kickass_rutherford`. Nextflow resolves it from the local execution history and matches it by session ID to the corresponding `.nextflow.log[.N]` file in the current directory.
- A session ID, or a unique prefix of one, or the literal `last` for the most recent run.
- A direct path to a log file, for example `.nextflow.log.4` or an absolute path.

If you give no argument, `logfile` uses the most recent run.

## Options

##### `-f, -follow`

Continuously print new lines as the file grows (similar to `tail -f`). Stop with Ctrl+C.

##### `-h, -help`

Print the command usage.

##### `-keep-ansi`

Preserve any ANSI escape sequences found inside log content. By default, Nextflow strips them to produce clean text.

##### `-l, -level <LEVEL>`

Minimum log level to print: `TRACE`, `DEBUG`, `INFO`, `WARN`, or `ERROR`.
Case-insensitive.
When set, Nextflow prints only entries at this level or higher.
Multi-line entries, such as stack traces, inherit the level of their parent entry.
By default, Nextflow applies no filtering.

##### `-n, -lines <N>`

Print only the last `N` log entries. Counts entries (one or more lines each), not raw lines.

##### `-no-pager`

Do not pipe the output through a pager.
By default, when standard output is a terminal, Nextflow pipes the output through `$NXF_PAGER`, then `$PAGER`, then `less -FR`.
Nextflow adds `-FR` to a bare `less` invocation so that colors render. Short outputs exit without entering the pager.
The `-f`/`-follow` option disables the pager.

##### `-no-ansi`

Disable colored output. By default, when the output destination is a terminal:

- Every line is prefixed with a colored 2-character level indicator.
- TRACE and DEBUG entries are dimmed.
- DEBUG, INFO, WARN and ERROR entries are syntax-highlighted to make them easier to read.

Nextflow disables styling when output goes to a non-terminal destination, such as a file or a pipe with `-no-pager`, or when the `NO_COLOR` environment variable is set.

## Examples

Print the log of the most recent run:

```console
$ nextflow logfile
```

Print the log of a specific run, looked up by name:

```console
$ nextflow logfile kickass_rutherford
```

Print a specific log file directly:

```console
$ nextflow logfile .nextflow.log.4
```

Show only warnings and errors from the most recent run:

```console
$ nextflow logfile -level WARN
```

Show the last 10 entries of an ongoing run and continue streaming new lines:

```console
$ nextflow logfile -n 10 -f
```
