---
title: Experiment manager (Logger)
description: >-
  To track other artifacts, such as histograms or model topology graphs first
  select one of the many experiment managers (loggers) supported by Lightning
canonical: >-
  https://lightning.ai/docs/pytorch/stable/reference/visualize/experiment_managers
---
# Experiment manager (Logger) {#experiment-manager-logger}

To track other artifacts, such as histograms or model topology graphs first select one of the many experiment managers (*loggers*) supported by Lightning

```python
from lightning.pytorch import loggers as pl_loggers

tensorboard = pl_loggers.TensorBoardLogger()
trainer = Trainer(logger=tensorboard)
```

then access the logger's API directly

```python
def training_step(self):
    tensorboard = self.logger.experiment
    tensorboard.add_image()
    tensorboard.add_histogram(...)
    tensorboard.add_figure(...)
```

## LitLogger {#litlogger}

To use [LitLogger](/docs/overview/experiment-management.md) first install the litlogger package:

```bash
pip install litlogger
```

Configure the logger and pass it to the `Trainer`:

```python
from lightning.pytorch.loggers import LitLogger

lit_logger = LitLogger(save_dir="logs/")
trainer = Trainer(logger=lit_logger)
```

Access the litlogger logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts

```python
class LitModel(LightningModule):
    def any_lightning_module_function_or_hook(self):
        lit_logger = self.logger.experiment
        lit_logger.log_file("generated_images.txt")
```

Here's the full documentation for the `LitLogger`.

## Comet.ml {#comet-ml}

To use [Comet.ml](https://www.comet.ml/site/) first install the comet package:

```bash
pip install comet-ml
```

Configure the logger and pass it to the `Trainer`:

```python
from lightning.pytorch.loggers import CometLogger

comet_logger = CometLogger(api_key="YOUR_COMET_API_KEY")
trainer = Trainer(logger=comet_logger)
```

Access the comet logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts

```python
class LitModel(LightningModule):
    def any_lightning_module_function_or_hook(self):
        comet = self.logger.experiment
        fake_images = torch.Tensor(32, 3, 28, 28)
        comet.add_image("generated_images", fake_images, 0)
```

Here's the full documentation for the `CometLogger`.

## MLflow {#mlflow}

To use [MLflow](https://mlflow.org/) first install the MLflow package:

```bash
pip install mlflow
```

Configure the logger and pass it to the `Trainer`:

```python
from lightning.pytorch.loggers import MLFlowLogger

mlf_logger = MLFlowLogger(experiment_name="lightning_logs", tracking_uri="file:./ml-runs")
trainer = Trainer(logger=mlf_logger)
```

Access the mlflow logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts

```python
class LitModel(LightningModule):
    def any_lightning_module_function_or_hook(self):
        mlf_logger = self.logger.experiment
        fake_images = torch.Tensor(32, 3, 28, 28)
        mlf_logger.add_image("generated_images", fake_images, 0)
```

Here's the full documentation for the `MLFlowLogger`.

## Tensorboard {#tensorboard}

[TensorBoard](https://pytorch.org/docs/stable/tensorboard.html) can be installed with:

```bash
pip install tensorboard
```

Configure the logger and pass it to the `Trainer`:

```python
from lightning.pytorch.loggers import TensorBoardLogger

logger = TensorBoardLogger()
trainer = Trainer(logger=logger)
```

Access the tensorboard logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts

```python
class LitModel(LightningModule):
    def any_lightning_module_function_or_hook(self):
        tensorboard_logger = self.logger.experiment
        fake_images = torch.Tensor(32, 3, 28, 28)
        tensorboard_logger.add_image("generated_images", fake_images, 0)
```

Here's the full documentation for the `TensorBoardLogger`.

## Weights and Biases {#weights-and-biases}

To use [Weights and Biases](https://docs.wandb.ai/guides/integrations/lightning) (wandb) first install the wandb package:

```bash
pip install wandb
```

Configure the logger and pass it to the `Trainer`:

```python
from lightning.pytorch.loggers import WandbLogger

wandb_logger = WandbLogger(project="MNIST", log_model="all")
trainer = Trainer(logger=wandb_logger)

# log gradients and model topology
wandb_logger.watch(model)
```

Access the wandb logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts

```python
class MyModule(LightningModule):
    def any_lightning_module_function_or_hook(self):
        wandb_logger = self.logger.experiment
        fake_images = torch.Tensor(32, 3, 28, 28)

        # Option 1
        wandb_logger.log({"generated_images": [wandb.Image(fake_images, caption="...")]})

        # Option 2 for specifically logging images
        wandb_logger.log_image(key="generated_images", images=[fake_images])
```

Here's the full documentation for the `WandbLogger`.
[Demo in Google Colab](http://wandb.me/lightning) with hyperparameter search and model logging.

## Use multiple exp managers {#use-multiple-exp-managers}

To use multiple experiment managers at the same time, pass a list to the *logger* `Trainer` argument.

```python
from lightning.pytorch.loggers import TensorBoardLogger, WandbLogger

logger1 = TensorBoardLogger()
logger2 = WandbLogger()
trainer = Trainer(logger=[logger1, logger2])
```

Access all loggers from any function (except the LightningModule *init*) to use their APIs for tracking advanced artifacts

```python
class MyModule(LightningModule):
    def any_lightning_module_function_or_hook(self):
        tensorboard_logger = self.loggers.experiment[0]
        wandb_logger = self.loggers.experiment[1]

        fake_images = torch.Tensor(32, 3, 28, 28)

        tensorboard_logger.add_image("generated_images", fake_images, 0)
        wandb_logger.add_image("generated_images", fake_images, 0)
```

---

**Navigation**

- Parent: [Visualize](/docs/pytorch/2.6.6/reference/visualize.md)
