spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Some lines in my log are truncated.

Open fsqx opened this issue 1 year ago • 4 comments

I replaced my existing logging system with spdlog, but when I checked the logs, some of them were truncated. They only output the ending part.

My project used Qt, and this is the part where I initialize spdlog.

Image

Here are some screenshots of the abnormal logs.

Image

Image

Image

Do you have any ideas on how to solve this kind of problem?

Looking forward to your reply. (・̀ᴗ・́)و ̑̑

fsqx avatar Jun 03 '25 10:06 fsqx

I don't think it is truncated in spdlog. Check to see if the console you are using has a specification for splitting (chunking) excessively long line data. For example, cmd.exe (on windows) has a limit of 8192 characters length: https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation

tt4g avatar Jun 03 '25 11:06 tt4g

I don't think it is truncated in spdlog. Check to see if the console you are using has a specification for splitting (chunking) excessively long line data. For example, cmd.exe (on windows) has a limit of 8192 characters length: https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation

Thank you for your reply, but the same content can be printed normally in subsequent logs. I have checked the byte count of this line, and it should not exceed 1,000.

Another phenomenon is that what it missed is the first half of this sentence.

fsqx avatar Jun 03 '25 15:06 fsqx

What console is causing the problem? And does the same problem reproduce on another console?

tt4g avatar Jun 03 '25 20:06 tt4g

I only use cmd in the Windows system.

I have just solved my problem. The reason is that using the static before InitConsole is not allowed, which would cause different InitConsole functions to be created and called in multithreading.

Use the static. Image

After removing the static. Image

Thank you very much! (≧∇≦)ノ

fsqx avatar Jun 04 '25 02:06 fsqx