question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support disabling logger or default to noop logger

See original GitHub issue

My organization has its own logging format (mostly similar to Pino’s output). But I cannot boot our logger before this library due to issues. We also have log shippers and destinations that expect that specific format to be adhered to. So to prevent this module from writing incompatible logs I have to:

const apm = require('elastic-apm-node').start({
  logger: Object.create(require('abstract-logging'))
});

At a very minimum, I’d like to see logger: false as a supported option to disable the logger. A more complete solution would be to use abstract-logging yourself internally and you’ll automatically gain compatibility with the list of loggers in https://github.com/elastic/apm-agent-nodejs/issues/1187#issuecomment-514103468. Note: this is what we do in Fastify – https://github.com/fastify/fastify/blob/0e39b83c3bde8a9cb6531ad2dbe960be75199e1d/lib/logger.js#L84-L88

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jsumnerscommented, Sep 26, 2019

Yes, that does seem to be a way to get it solved for now. But it isn’t a foolproof solution. There is no guarantee that logger.fatal will not be used in the future. It would really be nice to have the ability to disable the logger completely by logger: false.

1reaction
trentmcommented, Mar 23, 2021

In v3.10.0 of the agent support was added for an “off” logLevel in #1908

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable a log.Logger - Stack Overflow
For completely disabling logs, it's actually better to call log.SetFlags(0) and set the output to a no-op io.Writer (i.e., log.SetOutput(ioutil.Discard) ).
Read more >
SLF4J Manual
If you are using SLF4J 1.7 or earlier, the message would be: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation ...
Read more >
AWS Lambda function logging in Java
This page describes how to view Lambda function metrics using Amazon CloudWatch for the Java runtime.
Read more >
ASP.NET Core Blazor logging - Microsoft Learn
At default log levels and without configuring additional logging providers: ... NET Core logging is supported in Blazor WebAssembly apps.
Read more >
logger - Tcl Library Source Code: Documentation
The new logger service is initialized with the default loglevel set with logger::setlevel. ... Globally disables logging at and "below" the given level....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found