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.

custom log levels in HigherOrderOperation's `refreshAllLocations` method.

See original GitHub issue

refreshAllLocations by default logs at info and warn levels which is too noisy for our usecase. I believe that there is a case to allow customization of this behavior.

The CatalogBuilder, provides the logger used by the DatabaseEntitiesCatalog and the HigherOrderOperations instance, when creating them. The logger logs to our standard application’s stdout that is picked up by our logging daemons for our service logs.

As refreshAllLocations, we cannot disable or provide a dummy logger to the builder as that would mean we lose the error/warning logs on entities operations as well.

Feature Suggestion

We can solve this in 2 ways.

  1. Reduce the log levels in the refreshAllLocations to debug and info or simply debug.
  2. Allow the instantiation to customize the log levels.

I think option 2 is better , because it allows users to define how important these logs are for their respective purposes.

Possible Implementation

The builder can optionally provide methods to set the logging levels for each of the Catalog (Entities, Locations, higherOrderOperations) that users can then use to customize the logging levels. It can also have a default log level that it can use, in case the user doesn’t wish to supply one.

An example method would be something along the lines of :

setLoggingLevel(entitiesCatalog, logLevel) or setStandardLogLevel(entitiesCatalog, logLevel) and setErrorLogLevel(entitiesCatalogLevel, logLevel)or asetLogger(enum.entitiesCatalog, logger)`

Context

We are using the HigherOrderOperation class to track and update roughly 15,000+ entries. We are planning to add more entries in our system and this method currently is convenient to keep track of our existing catalog sources.

However, the presence of such a large catalog of items, is making it very hard to debug requests and issues via our logs. We run the refreshAllLocations for all the entries once a day and the class emits out approx. 3 log lines per entity. During the period of time when it updates the data, roughly 45,000 lines of logs are emitted ,alongside othe request and metrics logging. This makes sifting through the logs a burdensome task and we would like the ability to customize this behaviour.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
GoWindcommented, Dec 7, 2020

sounds like a good implementation idea. I will raise a PR with a child logger that can then be filtered out.

0reactions
benjdlambertcommented, Dec 10, 2020

This seems to be fixed now, reopen if not 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log4j – Custom Log Levels - Apache Logging Services
This method creates a new level for the specified name. After a log level is defined you can log messages at this level...
Read more >
Log4J2 | Create custom log levels and how to use them
The easiest way to use the logger is to just create a new logger with the LogManager and call the log levels from...
Read more >
How to add a custom loglevel to Python's logging facility
The new level needs to be added as an attribute to logging itself for consistency: logging.TRACE = logging.DEBUG - 5 . A method...
Read more >
Log4j Levels Example - Order, Priority, Custom Filters
If you have used log4j, you will notice that there are many methods to log messages. For example: logger.trace("My Log message"); ...
Read more >
Log levels - IBM
WebSphere Application Server controls the levels of all loggers in the ... Levels are cumulative; a logger can process logged objects at the ......
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