Skip to content

Commit de22600

Browse files
vordimoustrentm
andauthored
docs(instrumentation-winston): Clarify the duplicate logging workaround (#2831)
Co-authored-by: Trent Mick <[email protected]>
1 parent 4384c7b commit de22600

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/instrumentation-winston/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,25 @@ const logger = winston.createLogger({
137137
```
138138

139139
> [!IMPORTANT]
140-
> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`.
140+
> Logs will be **duplicated** if `OpenTelemetryTransportV3` is explicitly added as a Winston logger transport **and** `@opentelemetry/instrumentation-winston` is active with the [Log sending](#log-sending) feature (the default). If you are both using `OpenTelemetryTransportV3` and instrumentation-winston, be sure to either disable instrumentation-winston completely, or disable its Log sending feature (`disableLogSending: false`). For example:
141+
>
142+
> ```js
143+
> const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston');
144+
> const { registerInstrumentations } = require('@opentelemetry/instrumentation');
145+
> registerInstrumentations({
146+
> instrumentations: [
147+
> new WinstonInstrumentation({
148+
> disableLogSending: true
149+
> }),
150+
> ],
151+
> });
152+
> const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport');
153+
> // Winston import must be after the WinstonInstrumentation creation
154+
> const winston = require('winston');
155+
>
156+
> // ...
157+
> const logger = winston.createLogger(...);
158+
> ```
141159
142160
## Semantic Conventions
143161

0 commit comments

Comments
 (0)