---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../../modules.md) / [operations/logs](../index.md) / listLogFiles

# Function: listLogFiles()

> **listLogFiles**(`instance`, `options`): `Promise`\<[`LogFile`](../interfaces/LogFile.md)[]\>

Defined in: [packages/b2c-tooling-sdk/src/operations/logs/list.ts:155](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/operations/logs/list.ts#L155)

Lists log files on a B2C Commerce instance.

Filters in [ListLogsOptions.prefixes](../interfaces/ListLogsOptions.md#prefixes) are matched in one of two ways:

- **Prefix filters** (no `/`, e.g. `"error"`) match the extracted log-category
  prefix of files in the top-level `Logs/` directory.
- **Path filters** (contain a `/`, e.g. `"internal/server"`) recurse into the
  named subdirectory of `Logs/` and match against each file's path relative to
  `Logs/`. This is the only case that lists subdirectories — by default only the
  top-level `Logs/` directory is scanned.

## Parameters

### instance

[`B2CInstance`](../../../instance/classes/B2CInstance.md)

B2C instance to list logs from

### options

[`ListLogsOptions`](../interfaces/ListLogsOptions.md) = `{}`

Listing options (filters, sorting)

## Returns

`Promise`\<[`LogFile`](../interfaces/LogFile.md)[]\>

Array of log files

## Example

```typescript
// List all error and customerror logs (top-level)
const logs = await listLogFiles(instance, {
  prefixes: ['error', 'customerror'],
  sortBy: 'date',
  sortOrder: 'desc'
});

// List server logs in the internal/ subdirectory
const internal = await listLogFiles(instance, {prefixes: ['internal/server']});
```
