---
title: "Logging"
description: "Learn how to enable and configure logging in the Aerospike Rust client using the log crate and env_logger."
---

# Logging

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

The Aerospike Rust client uses the lightweight logging facade provided by the [`log` crate](https://crates.io/crates/log). Application using the Aerospike client can choose the logging implementation that is most suitable for its use case.

::: note
Logging is disabled by default. To enable logging, add one of the existing logging implementations that support the `log` API to your crate’s dependencies consult the documentation provided by the logging implementation.
:::

## Using the `log` API with `env_logger`

The [`env_logger` crate](https://crates.io/crates/env_logger) provides an implementation of the logging facade defined by the [`log` crate](https://crates.io/crates/log). To enable logging using `env_logger`, add it to your applications dependencies:

```plaintext
[dependencies]

env_logger = "0.11"
```

Then initialize the logger once at the start of your application, before any client calls are made:

```rust
env_logger::init();
```

## Enabling logging for the `aerospike` module

_(Following is a small excerpt of the `env_logger` documentation; for more information please refer to the [full documentation](https://docs.rs/env_logger/latest/env_logger/).)_

Log levels are controlled on a per-module basis, and by default all logging is disabled except for `error!`. Logging is controlled via the `RUST_LOG` environment variable. The value of this environment variable is a comma-separated list of logging directives. A logging directive is of the form:

```plaintext
path::to::module=log_level
```

To turn on all logging for the Aerospike client you would use a value of

```plaintext
RUST_LOG=aerospike
```

The actual log\_level is optional to specify. If omitted, all logging will be enabled. If specified, it must be one of the strings `debug`, `error`, `info`, `warn`, or `trace`.