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.

Changing logging level at runtime

See original GitHub issue

Is there any way to change the output logging level at runtime? I can’t figure out how to do this, but it would be a great feature to add if missing.

Essentially what I want is to be able to define my default logging when the program (a server, in my case) starts up. Then while the program is still running, have the ability to turn the output level up or down. For example, if someone reports a defect, turn the logging to debug for a while to see what’s going on and try to capture the problem. Then turn it back to warn or info for “normal” logging.

I saw that Issue #78 is similar to what I want; though I don’t need a watchdog component.

I tried using the clear() method followed by add() with a slightly modified set of options, but if the log level changes rapidly then the file transport can write logs in the wrong order. Not a huge deal, but it would be nice if the level were more easily changed instead of completely removing and re-adding everything.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
joegoldbeckcommented, Feb 28, 2017

In case people run into this in the present, this is now logger.transports[transportName].level = newLogLevel Doc

4reactions
indexzerocommented, Dec 9, 2014

This is possible through logger.setLevels, if you run into an issue again let us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Ways to Change Log Levels at Runtime - DZone
Merely select the logger and change the log level in just click of a button. As highlighted in the figure it will change...
Read more >
Changing the Logging Level at the Runtime for a Spring Boot ...
In this tutorial, we're going to look at ways we can change the logging level of a Spring Boot application at runtime. As...
Read more >
Dynamically Changing log4j log level - java - Stack Overflow
As described by Aaron, you can set the log level programmatically. You can implement it in your application in the way you would...
Read more >
Logback Change Log Level at Runtime Example
Start ChangeLogLevelDemo as a Java application. · Enter the “ERROR” level. · Watch the console outputting the messages. · Repeat steps 2 and...
Read more >
How to Dynamically Change Log Levels at Runtime with ...
Use Spring Boot properties to set specific log levels for particular packages/classes. Pass these in as runtime JVM options for greater ...
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