-
Notifications
You must be signed in to change notification settings - Fork 15
Custom logger is not supported anymore #44
Comments
@mderazon created a Bunyan stream, which might be useful. #21 (comment) |
@willmcclellan You are absolutely right - that's a mistake 😞 I'll make sure this get re-added. |
This commit completely rewrites and unifies the internal logging code. All output will now be in JSON format. Opbeat no longer relies on the `debug` module for debug-level logging. Instead all logging have now been rewritten to use the `pino` module and the previous debug calls now use the debug-level on the pino module. This means that the `DEBUG=opbeat` environment variable is no longer supported. Instead set the `logLevel` config option to `debug` (or set the equivalent `OPBEAT_LOG_LEVEL=debug` environment variable). ```js require('opbeat').start({ logLevel: 'debug' }) ``` By default the built-in logger will log to STDOUT. But using the new `logFile` config option (environment variable: `OPBEAT_LOG_FILE`), it's now possible to specify a file path or provide a writeable stream that the log should be written to. The `logFile` config option can also be set to one of the two magic strings `stdout` or `stderr` in which case logs will be streamed to either STDOUT or STDERR respectively. ```js // log to a file specified by a path require('opbeat').start({ logFile: '/var/log/opbeat.log' }) // log to a writable stream require('opbeat').start({ logFile: fs.createWriteStream('/var/log/opbeat.log') }) ``` It's now also (again) possible to supply a custom logger using the `logger` config option. It's expected that the logger conforms to the Log4j interface: ```js require('opbeat').start({ logger: require('bunyan')({level: 'info'}) }) ``` Fixes #44
This commit completely rewrites and unifies the internal logging code. All output will now be in JSON format. Opbeat no longer relies on the `debug` module for debug-level logging. Instead all logging have now been rewritten to use the `pino` module and the previous debug calls now use the debug-level on the pino module. This means that the `DEBUG=opbeat` environment variable is no longer supported. Instead set the `logLevel` config option to `debug` (or set the equivalent `OPBEAT_LOG_LEVEL=debug` environment variable). ```js require('opbeat').start({ logLevel: 'debug' }) ``` By default the built-in logger will log to STDOUT. But using the new `logFile` config option (environment variable: `OPBEAT_LOG_FILE`), it's now possible to specify a file path or provide a writeable stream that the log should be written to. The `logFile` config option can also be set to one of the two magic strings `stdout` or `stderr` in which case logs will be streamed to either STDOUT or STDERR respectively. ```js // log to a file specified by a path require('opbeat').start({ logFile: '/var/log/opbeat.log' }) // log to a writable stream require('opbeat').start({ logFile: fs.createWriteStream('/var/log/opbeat.log') }) ``` It's now also (again) possible to supply a custom logger using the `logger` config option. It's expected that the logger conforms to the Log4j interface: ```js require('opbeat').start({ logger: require('bunyan')({level: 'info'}) }) ``` Fixes #44
This commit completely rewrites and unifies the internal logging code. All output will now be in JSON format. Opbeat no longer relies on the `debug` module for debug-level logging. Instead all logging have now been rewritten to use the `pino` module and the previous debug calls now use the debug-level on the pino module. This means that the `DEBUG=opbeat` environment variable is no longer supported. Instead set the `logLevel` config option to `debug` (or set the equivalent `OPBEAT_LOG_LEVEL=debug` environment variable). ```js require('opbeat').start({ logLevel: 'debug' }) ``` By default the built-in logger will log to STDOUT. But using the new `logFile` config option (environment variable: `OPBEAT_LOG_FILE`), it's now possible to specify a file path or provide a writeable stream that the log should be written to. The `logFile` config option can also be set to one of the two magic strings `stdout` or `stderr` in which case logs will be streamed to either STDOUT or STDERR respectively. ```js // log to a file specified by a path require('opbeat').start({ logFile: '/var/log/opbeat.log' }) // log to a writable stream require('opbeat').start({ logFile: fs.createWriteStream('/var/log/opbeat.log') }) ``` It's now also (again) possible to supply a custom logger using the `logger` config option. It's expected that the logger conforms to the Log4j interface: ```js require('opbeat').start({ logger: require('bunyan')({level: 'info'}) }) ``` Fixes #44
This commit completely rewrites and unifies the internal logging code. All output will now be in JSON format. Opbeat no longer relies on the `debug` module for debug-level logging. Instead all logging have now been rewritten to use the `pino` module and the previous debug calls now use the debug-level on the pino module. This means that the `DEBUG=opbeat` environment variable is no longer supported. Instead set the `logLevel` config option to `debug` (or set the equivalent `OPBEAT_LOG_LEVEL=debug` environment variable). ```js require('opbeat').start({ logLevel: 'debug' }) ``` By default the built-in logger will log to STDOUT. But using the new `logFile` config option (environment variable: `OPBEAT_LOG_FILE`), it's now possible to specify a file path or provide a writeable stream that the log should be written to. The `logFile` config option can also be set to one of the two magic strings `stdout` or `stderr` in which case logs will be streamed to either STDOUT or STDERR respectively. ```js // log to a file specified by a path require('opbeat').start({ logFile: '/var/log/opbeat.log' }) // log to a writable stream require('opbeat').start({ logFile: fs.createWriteStream('/var/log/opbeat.log') }) ``` It's now also (again) possible to supply a custom logger using the `logger` config option. It's expected that the logger conforms to the Log4j interface: ```js require('opbeat').start({ logger: require('bunyan')({level: 'info'}) }) ``` Fixes #44
Is there an ETA on the fix being released? |
ping: @watson |
@jsumners Sorry about the slow reply. This have been held back by a refactoring process replacing the entire logging logic, which unfortunately is taking longer than expected. We are trying to unify debugging logs and regular logs into the same logger (today we use the debug module for debugging). At the same time we have experimented with switching to a json logger. This is not technically a big issue, but it means that all output will be json formatted. This is really helpfull when passing the logs programatically, but it's not that user-friendly when you're just reading it in the console. Do you have any preferences in this matter? |
@watson as a maintainer of Pino, I want to use Pino. If you backport pinojs/pino#186 to the legacy release then you can easily make the output of this module's logs much prettier if the user hasn't supplied a logger. As for debug logging of |
@jsumners that PR might solve all our problems, thanks 😃 - I've been falling behind on that lately 😞 Regarding log level, why is your preference |
@watson When I enable |
@jsumners Good point. Thanks for the feedback |
Opbeat has joined forces with Elastic and this agent is therefore deprecated. So I'll go ahead and close this issue. Our new product is called Elastic APM, it's open source, and the Node.js agent used there is based off this agent. Support for a custom logger have been re-added to the Elastic APM Node.js Agent, so if you're interested in trying out Elastic APM, we'd love your feedback. |
Contrary to the readme, it appears that custom loggers (bunyan, winston etc) are not supported anymore. From the history it looks as though this was removed in the 3.x.x release
The text was updated successfully, but these errors were encountered: