Platform Docs
Agent Docs
Support Docs
Logging
Logging
Scout logs internal activity via a configured logging function with the signature (msg: string, level: LogLevel) => void.
Express middleware logging
To enable agent logging, pass a logFn to init() in your scout.js:
// scout.js
const { init, consoleLogFn } = require("@scout_apm/scout-apm");
init({
name: "<application name>",
key: "<scout key>",
monitor: true,
logFn: consoleLogFn,
});
// app.js
require("./scout"); // must be first
const express = require("express");
const { expressMiddleware } = require("@scout_apm/scout-apm");
const app = express();
app.use(expressMiddleware({ requestTimeoutMs: 0 }));
// ... Add other middleware/handlers ...
app.listen(3000);
If you are using winston you may build a logFn by passing a winston.Logger to the exported buildWinstonLogFn helper:
const { init, buildWinstonLogFn } = require("@scout_apm/scout-apm");
init({
name: "<application name>",
key: "<scout key>",
monitor: true,
logFn: buildWinstonLogFn(yourLogger),
});
If a winston.Logger instance is provided, Scout’s logging defaults to the same log level as the instance, otherwise it defaults to ERROR. You may set the logging to a stricter level to quiet the agent’s logging via the logLevel in the config sub-object (or SCOUT_LOG_LEVEL via ENV). The underlying LoggerInterface’s level will take precedence if it is tighter than the logLevel configuration.
Log Levels
The possible log levels are as follows:
DEBUGINFOWARNERROR