Logging
The Aerospike Node.js client has internal logging. Use the Log object to control the application log verbosity level and specify the location for storing log messages. By default, Log is set to INFO to send its log messages to stderr.
Log verbosity levels are defined in aerospike.log:
OFFERRORINFO(default)DEBUGDETAIL
Configure Logging
Configure client logging when setting system configuration. In the client configuration object, specify a log field to contain the following objects:
level— The log verbosity level.file— The path to the log file.
This is an example configuration with defined log settings:
const Aerospike = await import("aerospike");
// Set hosts to your server's address and portconst config = { hosts: "YOUR_HOST_ADDRESS:YOUR_PORT", log: { level: aerospike.log.INFO, file: "/var/log/myapplication.log", },};
// Establishes a connection to the serverconst client = await Aerospike.connect(config);Update Logging
Modify client logging during run time by using client.updateLogging(), which takes an object.
To reset the log level while the application is running:
client.updateLogging({ level: aerospike.log.TRACE, file: "/var/log/new_location.log",});