Skip to content

Commit 291ff1d

Browse files
Merge pull request #51 from DataDog/darcy.rayner/set-inject-log-context-default
Enable log injection by default
2 parents 41a8d0b + 67aafe2 commit 291ff1d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ If you set the value of this variable to "true" then the Lambda layer will incre
8787

8888
### DD_LOGS_INJECTION
8989

90-
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.
90+
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.
91+
92+
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.
93+
94+
Set the environment variable `DD_LOGS_INJECTION` to `false` to disable this feature.
9195

9296
## Usage
9397

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datadog-lambda-js",
3-
"version": "1.15.0",
3+
"version": "2.16.0",
44
"description": "Lambda client library that supports hybrid tracing in node js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const defaultConfig: Config = {
4141
autoPatchHTTP: true,
4242
debugLogging: false,
4343
enhancedMetrics: true,
44-
injectLogContext: false,
44+
injectLogContext: true,
4545
logForwarding: false,
4646
mergeDatadogXrayTraces: false,
4747
shouldRetryMetrics: false,
@@ -153,7 +153,7 @@ function getConfig(userConfig?: Partial<Config>): Config {
153153
}
154154

155155
if (userConfig === undefined || userConfig.injectLogContext === undefined) {
156-
const result = getEnvValue(logInjectionEnvVar, "false").toLowerCase();
156+
const result = getEnvValue(logInjectionEnvVar, "true").toLowerCase();
157157
config.injectLogContext = result === "true";
158158
}
159159

0 commit comments

Comments
 (0)