krasa / GrepConsole

IntelliJ plugin - https://plugins.jetbrains.com/plugin/7125
Apache License 2.0
428 stars 57 forks source link

truncate a log file, no display in console #256

Closed Noctune closed 4 months ago

Noctune commented 1 year ago

Describe the bug truncate a log file, no display in console.

To Reproduce Steps to reproduce the behavior:

  1. tail a log file like debug.log, use "echo 123 >> debug.log" to append line, the console displays the new line.
  2. use "echo 234 > debug.log" to clear the file and write a new line, the console display nothing.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Environment :

Additional context

ipcoder commented 4 months ago

I am suffering from the same problem. Is not updated when log file is renewed.

krasa commented 4 months ago

You can update and try it. Not sure if checking size is enough https://github.com/krasa/GrepConsole/blob/b5cab50ced1fe580d6db7ddb16b83d3edbcb9e74/src/main/java/krasa/grepconsole/tail/MyBaseOutputReader.java#L136

ipcoder commented 4 months ago

Thank you for this quick fix! It works in most the cases, so this solution is quite acceptable.

The only thing is that it keeps the portion of the log before the truncation. Is it possible to clear it from the console, and keep only the lines coming after the truncation?

Thanks

krasa commented 4 months ago

Done :-)

ipcoder commented 4 months ago

Brilliant! Thanks