Configure logging for Node.js

To prevent crowding stdout, INFO-level statements aren't logged to the console unless the environment variable DEBUG is set to include the Contrast namespace: DEBUG=contrast:*.

The namespace can also be manipulated to show and hide certain paths.

For example, if you want to only see statements within the namespaces contrast:hooks and contrast:http, you can set the environment variable as DEBUG=contrast:hooks,contrast:http. If you want to hide certain namespaces, prepend a -, as in DEBUG=contrast:*,-contrast:hooks.

By default, the agent logs to /node-contrast.log. For performance reasons, verbose logging options are disabled. The following configuration options allow you to modify how the agent handles file logging.

Parameter

Description

--agent.logger.append [false]

If false, create a new log file on startup instead of appending and rolling daily. Default is true.

--agent.logger.level

Logging level: FATAL, ERROR, WARN, INFO, DEBUG or TRACE. Overrides FeatureSet:logLevel. Default is ERROR.

--agent.logger.path

Where Contrast will put its debug log. Default is node-contrast.log.

--agent.logger.stdout [false]

If false, suppress output to STDOUT. Default is true.