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.

Logging double, until refresh

See original GitHub issue

Haai,

So i’m using Hangfire.Console, and while keeping the page open looking at the realtime updates (amazing) - it’s logging all entries twice for some reason. see below:

image

If I refresh the page, the doubles are gone - so it only happens for new entries whilst I keep the page open.

This is the logging call:


            // set color according to "level"
            context.SetTextColor(
                // warning
                level == LogLevel.Warning 
                    ? ConsoleTextColor.DarkYellow 
                    // error OR critical
                    : level == LogLevel.Error || level == LogLevel.Critical 
                        ? ConsoleTextColor.Red 
                        // Trace
                        : level == LogLevel.Trace 
                            ? ConsoleTextColor.Gray 
                            // Info/Debug
                            : ConsoleTextColor.White
            );

            context.WriteLine($"{msg}");
            context.ResetTextColor();

Any ideas if this is a bug or an issue on my side?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
wernerb90commented, Sep 16, 2017

Haai,

Yeah, almost thought I was being retarded… I had it twice,

once:


            services.AddHangfire(c =>
            {
                c.UseConsole();
            });

And:

            GlobalConfiguration.Configuration.UseConsole();

… but I removed the first one from the above, but it still does the same as before.

0reactions
pieceofsummercommented, Sep 18, 2017

I think I will add a guard against calling UseConsole twice in the next version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate log output when using Python logging module
The problem is that every time you call myLogger() , it's adding another handler to the instance, which causes the duplicate logs.
Read more >
Logging Cookbook — Python 3.11.4 documentation
This page contains a number of recipes related to logging, which have been found ... until Ctrl+C is pressed while True: logger.debug('debug message') ......
Read more >
Created task appears in double until refresh [HELP] : r/clickup
Hello, So I'm creating an organisational system in Clickup for my company and I'm currently transferring a lot of tasks from an old...
Read more >
Python Logging Best Practices: The Ultimate Guide
Read about Python logging best practices and how to get the best log monitoring setup for your organization. Learn what Python logging is ......
Read more >
8 Advanced Python Logging Features that You Shouldn't ...
Python provides a quite powerful and flexible built-in logging module with many advanced features. In this article, I want to share 8 advanced ......
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