diff --git a/README.md b/README.md index be321af4..b32bc36a 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,11 @@ If you set the value of this variable to "true" then the Lambda layer will incre ### DD_LOGS_INJECTION -To connect logs and traces, set the environment variable `DD_LOGS_INJECTION` to `true` if `console` is used for logging. For other logging libraries, see instructions for [automatic](https://docs.datadoghq.com/tracing/advanced/connect_logs_and_traces/?tab=nodejs#automatic-trace-id-injection) and [manual](https://docs.datadoghq.com/tracing/advanced/connect_logs_and_traces/?tab=nodejs#manual-trace-id-injection) trace id injection. +By default, the Datadog trace id gets automatically injected into the logs for correlation, if using `console` or a logging library supported for [automatic](https://docs.datadoghq.com/tracing/connect_logs_and_traces/?tab=nodejs#automatic-trace-id-injection) trace id injection. + +See instructions for [manual](https://docs.datadoghq.com/tracing/connect_logs_and_traces/?tab=nodejs#manual-trace-id-injection) trace id injection, if using other logging libraries. + +Set the environment variable `DD_LOGS_INJECTION` to `false` to disable this feature. ## Usage diff --git a/package.json b/package.json index dde3f484..455b5339 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datadog-lambda-js", - "version": "1.15.0", + "version": "2.16.0", "description": "Lambda client library that supports hybrid tracing in node js", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 2abbbb82..565f93c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,7 +41,7 @@ export const defaultConfig: Config = { autoPatchHTTP: true, debugLogging: false, enhancedMetrics: true, - injectLogContext: false, + injectLogContext: true, logForwarding: false, mergeDatadogXrayTraces: false, shouldRetryMetrics: false, @@ -153,7 +153,7 @@ function getConfig(userConfig?: Partial): Config { } if (userConfig === undefined || userConfig.injectLogContext === undefined) { - const result = getEnvValue(logInjectionEnvVar, "false").toLowerCase(); + const result = getEnvValue(logInjectionEnvVar, "true").toLowerCase(); config.injectLogContext = result === "true"; }