dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Tracer Logs not showing when "logger" config field is provided

Open GeoffreyPlitt opened this issue 2 years ago • 2 comments

We're using dd-trace to send APM logs to DataDog from NodeJS/Hapi, and it works well.

However, I am now debugging an issue with DataDog APM tracing (runMetrics not sent even when runMetrics:true is set in init), and DataDog support has asked for "Tracer Debug logs". So I've added a "logger" field to our init to enable tracer logs, per https://docs.datadoghq.com/tracing/troubleshooting/tracer_debug_logs/?code-lang=nodejs#review-debug-logs.

Here's our tracer init:

tracer.init({
		runtimeMetrics: true,
		logger: {
			debug: console.log,
			error: console.log,
			warn: console.log,
			info: console.log,
		},
	});

However, when we run our server and make requests, there are no tracer logs printed. Everything else looks fine but there are no tracer logs printing. Is this a bug? Are the docs wrong?

Node 14.21.3 dd-trace 3.21.0

GeoffreyPlitt avatar May 17 '23 22:05 GeoffreyPlitt

hey @GeoffreyPlitt , can you try by explicitly setting the log level to debug?

const tracer = require('dd-trace').init({
  runtimeMetrics: true,
  logger: {
    logLevel: 'debug', 
    debug: console.log,
    error: console.log,
    warn: console.log,
    info: console.log,
  },
});

Also, have you exported this variable on your server export DD_TRACE_DEBUG=true or set this in your .env file?

anmol242 avatar May 27 '23 23:05 anmol242

Yes, the env var is true, and I tried logLevel:'debug' but still don't see tracer logs. Perhaps your suggestion is for tracer v4? I cannot upgrade to 4 due to Node version constraint. In fact, I get typescript warnings that "logLevel" is not an allowed option.

(dd-trace 3.21.0)

GeoffreyPlitt avatar Jun 01 '23 01:06 GeoffreyPlitt