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.

Progressbar doesn't print in single line

See original GitHub issue

Kudos for the great utility @ctongfei , I had integrated progress bar with my application and the progress keep printing in new line(Tried in terminal and eclipse ).I’m using apache log4j2 for logging. Below is my code.

`

                try (InputStream inputStream = new FileInputStream(source);
	    		ProgressBar pb = new ProgressBarBuilder()
	            .setInitialMax(inputStream.available())
	            .setTaskName("Transfering")
	            .setConsumer(new DelegatingProgressBarConsumer(logger
                ::info)).setUnit("MB", 1048576)
	            .build()) {
		    

                byte[] chunk = new byte[102400];
		    int chunkLen = 0;
		    

		    while ((chunkLen = inputStream.read(chunk)) != -1) {
		    	pb.stepBy(chunkLen);
		    	session.getBasicRemote().sendBinary(ByteBuffer.wrap(chunk, 0, chunkLen));
		    }
		  
	     
	        } catch (IOException ex) {
	        	
	            logger.log(Level.ERROR,"Error ouccured while sending data from client ::",ex);
	        }`

Also i have tried all the visual styles. Any help is appreciated.

test

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ctongfeicommented, Jul 16, 2020

Maybe we should reopen this as this seems to be a valid concern? It seems that it is because the header of the logger each line. Probably would be fixed if #71 is fixed, so that you can set a custom width?

1reaction
ctongfeicommented, Jul 17, 2020

@cloudnotify The progress bar has no knowledge of your logger header [16 Jul 2020 22:59:57 INFO ] - , so the computed width is wrong

Read more comments on GitHub >

github_iconTop Results From Across the Web

python progress bar using tqdm not staying on a single line
To do that, you can print your messages using tqdm.write(msg) instead of print(msg) . If you don't want to modify run_apply() to use...
Read more >
progress is not updating the progress bar on a single line #109
Hello, I'm trying too use progress with IR kernel in jupyter and I keep getting an output like: Any ideas on how to...
Read more >
Write-Progress (Microsoft.PowerShell.Utility) - Microsoft Learn
This command displays the progress of a for loop that counts from 1 to 100. The Write-Progress cmdlet includes a status bar heading...
Read more >
Progress Bars in Python Terminal - YouTube
Today we learn how to create and display progress bars in the command line of a Python application.
Read more >
How To Add A Progress Bar In Python With Just One Line
In this Python Tutorial I show you how you can add a Progress Bar to your Python code in just one line of...
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