The `debug` option in `tracer.init` doesn't work
stanislav-halyn opened this issue · 5 comments
The docs here say that in order to enable custom logging, you need to pass debug: true
to the tracer.init
, but it's not working. Is this intentional functionality?
I guess the reason is because it's ignored when initializing the Config
class.
[this.debug = logConfig.enabled](https://github.com/DataDog/dd-trace-js/blob/master/packages/dd-trace/src/config.js#L247)
When I change this line to this.debug = coalesce(options.debug, logConfig.enabled)
it starts working.
It looks like the documentation is wrong, as the programmatic debug option has been removed a very long time ago in the 2.0.0 release. Instead you should use the environment variable DD_TRACE_DEBUG
. Please check out the migration guide referring to that change: https://github.com/DataDog/dd-trace-js/blob/master/MIGRATING.md#configuration
@stanislav-halyn I can't see the place in the link you sent where it mention debug: true
?
@simon-id Oh, I didn't know it's an outdated API
It says Custom logger to be used by the tracer (if debug = true), should support error(), warn(), info(), and debug() methods see https://datadog.github.io/dd-trace-js/#custom-logging
in the link I attached.
Since it said debug = true
I figured it refers to the debug
in the options
Since it's not a bug, I'm closing the issue.
Ah indeed I found it now. I'll try to find how to update it. Thank you for reporting this!