Disable/Suppress ERROR printouts on Levels Report after CTRL+C

Issue #17 new
Jon Drews
created an issue

Is there a way to disable the Levels Report after hitting CTRL+C to stop tailing a log with log4tail? Or perhaps suppress printouts on the ERROR log?

In development/test systems, I'll often have a plethora of ERROR logs, which means I end up having to scroll back a good bit.


Comments (10)

  1. jordilin repo owner

    No, there's no way to suppress the ERROR traces in the report. You can ignore traces in the standard output using --ignore regex. For instance, doing log4tail --ignore ERROR yourlog.log would suppress all ERROR levels. If the ERROR traces you want to ignore have something like >>"ERROR thirdpartylibrary_name error_trace", you would be able to effectively suppress in the output the third party library errors by doing:

    log4tail --ignore "ERROR libraryname" yourlog.log

    But the final report would still report on that. I actually I think that whatever is caught in --ignore should not be reported, and that would be something that can be implemented.

  2. Jon Drews reporter

    Hmm. I still want to see the error messages in the tail.

    It's just that when I hit CTRL+C, I end up having to scroll back about 300 lines to get to the line right before the Levels Report. This happening because the Levels Report is printing out each ERROR line.

    I understand this is picky, and that's why I set this ticket to trivial. I wonder if I can do this with same fancy bash scripting... I'll have to research.

  3. jordilin repo owner

    You can additionally tell log4tail to send a report to a file. It basically sends reports to an output file aside from the final standard output one when you do Ctrl-C.

    In configuration file say:

    analyticsnotification = /path/to/mytailreport.txt analyticsgaptime = 10

    and it will report every 10 seconds (appending) to mytailreport.txt

    log4tail -c config.txt mylog.log

  4. Jon Drews reporter

    Hmm well that would still have the same issue where I have to scroll up 300+ lines to get to an ERROR log entry I care about.

    I'll look around in the code and see if I can provide a patch that would allow for another command line argument to suppress ERROR line printouts after a CTRL+C

  5. Jon Drews reporter

    Alright I made the code changes to make this happen. I added a "--notimestamp" option and passed it on down to Resume.report() so it does "print len(logKey[level])" when the flag is set. I'll hopefully test tomorrow and pass on to you. Standby.

    I guess the best way to pass it on is a pull request? I can just tar it up if you'd rather. Let me know.

  6. jordilin repo owner

    I get the idea. I'll modify the code, change some things, fix the tests and make a new release. I'll mention your contribution in the next release Changelog if you don't mind.

  7. Log in to comment