Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Latest commit

 

History

History
28 lines (20 loc) · 802 Bytes

configure-logs.md

File metadata and controls

28 lines (20 loc) · 802 Bytes

Configure Logs

Setup logging in your application

In order to see log information, you must instrument your application with a logger.
Add a logger when initializing the Aspecto telemetry:

const Instrument = require('@aspecto/opentelemetry');
Instrument({
    local: true,
    logger: myLogger
});

Then, configure your logger to collect logs for the levels you are interested in.
If your logger is initialized or changed later in your service lifecycle, you can also set the logger after initializing Aspecto, like this:

const Instrument = require('@aspecto/opentelemetry');
const { setLogger } = Instrument({ local: true });

 // initialize your service ...
 setLogger(myLogger); 

{% page-ref page="../../deployed-environment/logs-correlation.md" %}