Skip to content

RCBC-550: Access C++ log level using C++ core API instead of spdlog's default logger#229

Open
DemetrisChr wants to merge 1 commit into
couchbase:mainfrom
DemetrisChr:RCBC-550-process-fork-logger
Open

RCBC-550: Access C++ log level using C++ core API instead of spdlog's default logger#229
DemetrisChr wants to merge 1 commit into
couchbase:mainfrom
DemetrisChr:RCBC-550-process-fork-logger

Conversation

@DemetrisChr

@DemetrisChr DemetrisChr commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Motivation

Backend.get_log_level results in a segmentation fault when used after a process fork. The reason for that is that we get the log level from spdlog's default logger, which is destroyed by the C++ SDK after the fork event (the SDK doesn't actually use spdlog's default logger). We should use the logger API provided by the C++ SDK instead of using the spdlog API directly. This affected Cluster#connect when using the default ThresholdLoggerTracer as it calls Backend.get_log_level

Change

  • Use the C++ SDK's logger API to access and set the log level, instead of directly using the spdlog API.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Ruby client’s native logger integration to query/set log levels via the Couchbase C++ core logger API (instead of spdlog’s default logger), and adds a regression test for RCBC-550 covering connect-after-fork behavior.

Changes:

  • Switch Backend.set_log_level / Backend.get_log_level to use core::logger::{set_log_levels,get_lowest_log_level}.
  • Add a regression test that forks a process and connects/disconnects in the child.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/couchbase_test.rb Adds a fork-based regression test for RCBC-550.
ext/rcb_logger.cxx Uses C++ core logger API for log-level set/get instead of spdlog global logger.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/couchbase_test.rb

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread test/couchbase_test.rb Outdated
@DemetrisChr DemetrisChr force-pushed the RCBC-550-process-fork-logger branch 2 times, most recently from a17e6fc to bfa2d37 Compare June 22, 2026 10:59
@DemetrisChr DemetrisChr force-pushed the RCBC-550-process-fork-logger branch from bfa2d37 to 11aa024 Compare June 22, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants