PCL2 icon indicating copy to clipboard operation
PCL2 copied to clipboard

日志中的线程名会出现非预期字符

Open copytiao opened this issue 4 months ago • 4 comments

检查项

描述

VSCode 打开部分日志的线程名会有非常长的 NUL 字符

影响阅读

重现步骤

下载版本(可能需要)然后 VSCode 打开日志

日志与附件

Image

Log1 - 副本 (2).txt

copytiao avatar Aug 16 '25 10:08 copytiao

这好像是 PCL日志系统的老 Bug了,经常会出现一堆 \0

tangge233 avatar Aug 17 '25 04:08 tangge233

如果日志要线程安全的话,在大量写入日志的时候会导致严重的性能下降,所以刻意地允许日志线程不安全地写入。 作为副作用,这会很罕见地造成这个情况。

LTCatt avatar Aug 17 '25 22:08 LTCatt

龙猫可以用 ConcurrentQueue 代替 StringBuilder 做列表的 :\

可以看下 CE 这的高性能日志写入实现 https://github.com/PCL-Community/PCL.Core/blob/main/Logging/Logger.cs

tangge233 avatar Aug 18 '25 04:08 tangge233

@onestardao 请不要发表无用评论,谢谢配合

copytiao avatar Aug 23 '25 08:08 copytiao