---
title: Logging
description: ""
pubDate: 2026-08-17T09:53:44.266Z
antora:
  editUrl: https://github.com/couchbase/docs-sdk-cxx/edit/release/1.1/modules/howtos/pages/collecting-information-and-logging.adoc
  xref: xref:1.1@cxx-sdk:howtos:collecting-information-and-logging.adoc[]
---

[Consult the llms.txt file for a full list of contents](/llms.txt)
[View original HTML](/cxx-sdk/1.1/howtos/collecting-information-and-logging.html)

# Logging

> 

The Couchbase C++ SDK allows logging to be configured programmatically. Internally, the SDK uses the [spdlog](https://github.com/gabime/spdlog) logging library.

Once the logger has been initialized, The default log level is `info`.

The following log levels are supported (in order of increasing amount of information logged):

1. off
2. critical
3. error
4. warning
5. info
6. debug
7. trace

The C++ SDK can be configured to send logs to standard output, or to a file. The logger can be initialized and logging level changed like so:

```c++
#import <couchbase/logger.hxx>

void
initialize_logger()
{
    // Initialize logging to standard output
    couchbase::logger::initialize_console_logger();

    // Initialize logging to a file
    couchbase::logger::initialize_file_logger("/path/to/file");

    // Set log level
    couchbase::logger::set_level(couchbase::logger::log_level::warn);
}
```