ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver Logging

Logging¶

The driver uses events to expose logging information, keeping it decoupled from any specific logging framework.

The Client class inherits from EventEmitter and emits 'log' events:

client.on('log', (level, target, message, furtherInfo) => {
  console.log(`${level} - ${target}: ${message}`);
});

Enabling logging¶

Logging is enabled by default. When no logLevel is specified, events at warning level and above are captured. We recommend explicitly setting the desired logging level when using this driver.

To choose a specific minimum severity:

const { Client, types } = require('@scylladb/driver');

const client = new Client({
  contactPoints: ['127.0.0.1'],
  logLevel: types.logLevels.info,
});

To disable logging entirely, set logLevel to 'off':

const { Client, types } = require('@scylladb/driver');

const client = new Client({
  contactPoints: ['127.0.0.1'],
  logLevel: types.logLevels.off,
});

The callback is registered when connect() is called and unregistered on shutdown(). No log events are emitted before the client connects (with a few exceptions, such as attempting to use the client after shutdown).

Log levels¶

Log levels are exposed through the types.logLevels enum:

Enum variant

Raw value

Description

logLevels.trace

'trace'

Finest-grained diagnostic information (TRACE events)

logLevels.debug

'debug'

Fine-grained diagnostic information (DEBUG events)

logLevels.info

'info'

High-level informational messages

logLevels.warning

'warning'

Potentially harmful situations

logLevels.error

'error'

Error conditions

logLevels.off

'off'

Disables logging entirely

The logLevel option acts as a filter: only events at or above the configured severity are delivered to the listener. The majority of filtering happens on the native side, before crossing the FFI boundary, so suppressed events have negligible overhead.

logLevel value

Events delivered

not set

WARN and above — default

logLevels.off

None

logLevels.trace

All (TRACE and above)

logLevels.debug

DEBUG and above

logLevels.info

INFO and above

logLevels.warning

WARN and above

logLevels.error

ERROR only

The trace level is only suitable for debugging and is usually very noisy. We recommend gathering events from info and above in production environments.

Event arguments¶

Each 'log' event delivers four arguments:

Argument

Type

Description

level

string

One of the level strings from the table above.

target

string

Identifies the source of the event. Either a class name (e.g. "Client") or an internal module path (e.g. "scylla::network::connection").

message

string

Human-readable description of the event.

furtherInfo

string

Additional structured context. Some events include key=value pairs from tracing spans (e.g. peer_addr=10.0.0.1:9042). May be an empty string.

Event sources¶

Log events are emitted by both the Rust driver core and the JavaScript wrapper. The target field identifies where an event originated — it contains either an internal module path (e.g. "scylla::network::connection") or a JS class name (e.g. "Client").

Both sources deliver events through the same 'log' event, so a single listener receives everything.

Multiple clients¶

Each Client registers its own logging callback independently. Multiple clients can coexist, each with its own logLevel.

Note

All clients share the same underlying Rust tracing subscriber. This means every client receives log events from the entire process — including events triggered by other Client instances. Keep this in mind when filtering or routing events.

Example¶

const { Client, types } = require('@scylladb/driver');

const client = new Client({
  contactPoints: ['10.0.1.101', '10.0.1.102'],
  logLevel: types.logLevels.info,
});

client.on('log', (level, target, message, furtherInfo) => {
  const extra = furtherInfo ? ` (${furtherInfo})` : '';
  console.log(`[${level}] ${target}: ${message}${extra}`);
});

await client.connect();
// [info] Client: Connecting to cluster using 'ScyllaDB Node.js RS Driver' version ...
// [info] scylla::cluster::worker: Node added to cluster: ...
// ...

await client.shutdown();

Was this page helpful?

PREVIOUS
Fetching Large Result Sets
NEXT
Policies
  • Create an issue
  • Edit this page

On this page

  • Logging
    • Enabling logging
    • Log levels
    • Event arguments
      • Event sources
    • Multiple clients
    • Example
ScyllaDB Node.js Driver
Search Ask AI
  • v0.6.1
    • main
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • Duration
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • FrameReader
      • GraphResultSet
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Path
      • Point
      • Polygon
      • Property
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 20 Jun 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2