简体   繁体   English

行为异常-控制台停止打印

[英]Strange behavior - Console stops printing

I have encountered some strange behavior which I can't explain. 我遇到了一些无法解释的奇怪行为。

I'm using boost log v1 to log to the console using wtext_ostream_backend and to a file using wtext_file_backend . 我使用升压日志V1登录到使用控制台wtext_ostream_backend和文件使用wtext_file_backend

Everything usually work fine, but just the other day the application stopped printing to the console, though it continued to log to file. 一切通常都可以正常工作,但是就在前一天,尽管应用程序继续记录到文件,但它停止向控制台打印。 When I looked in the file for the line where the console stopped printing i noted something strange: 当我在文件中查找控制台停止打印的那一行时,我注意到一些奇怪的事情:

0: [02/07/12 13:49:38] [07437538] [info]    Client 10.28.62.1 was disconnected
1: [02/07/12 13:49:40] [07437538] [info]    Received message from 10.50.128.77: [02/07/12 13:49:40] [07437538] [info]    Sent message to 10.50.128.77: 400 ERROR\r\n2[02/07/12 13:49:40] [07437538] [info]    Received message from 10.28.48.9: VERSION\r\n
4: [02/07/12 13:49:40] [07437538] [info]    Received message from 10.28.48.9: VERSION\r\n
3: [02/07/12 13:49:40] [00C79D10] [debug]   Executed command: VersionCommand

If you look at line 1: you can see that Received message from 10.50.118.77: abruptly end and the next message is written without line breaks. 如果查看第1:行,则可以看到Received message from 10.50.118.77:突然结束,并且下一条消息写入时没有换行符。 Which otherwise never is the case. 否则情况将永远不会如此。

The last thing the console printed was Received message from 10.50.118.77: . 控制台最后打印的内容是Received message from 10.50.118.77:

Any ideas what might cause this? 有什么想法可能导致这种情况吗? Could it be some weird character that followed Received message from 10.50.118.77: that messes everything up? 可能是Received message from 10.50.118.77:后出现的一些奇怪的字符Received message from 10.50.118.77:把所有事情Received message from 10.50.118.77:了吗? How can avoid/tolerate such characters? 如何避免/容忍此类字符?

也许您没有正确地使用null char终止字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM