SeasX / SeasLog

An effective,fast,stable log extension for PHP.http://pecl.php.net/package/SeasLog http://php.net/SeasLog
http://seasx.github.io/SeasLog/
Other
1.2k stars 276 forks source link

写文件每一行结尾多了这个 ^Z^Z 怎么回事? #278

Closed alu12138 closed 4 years ago

alu12138 commented 5 years ago

已经用trim去掉了,想问一下是配置错了吗? php7.1 seaslog1.9 [seaslog] extension = "seaslog.so" ;日志格式模板 默认"%T | %L | %P | %Q | %t | %M" seaslog.default_template = "%M" ;是否以目录区分Logger 1是(默认) 0否 seaslog.disting_folder = 0 ;是否启用buffer 1是 0否(默认) seaslog.use_buffer = 1 ;buffer中缓冲数量 默认0(不使用buffer_size) seaslog.buffer_size = 100 ;过滤日志中的回车和换行符 (默认为0) seaslog.trim_wrap = 1

alu12138 commented 5 years ago

\SeasLog::setBasePath($dirname); \SeasLog::info(trim($file_single_content));

alu12138 commented 5 years ago

是不是跟我内容后面都加了\r\n有关系?

769344359 commented 4 years ago

应该和换行或者tab有关

769344359 commented 4 years ago

有相关截图和内容吗?

769344359 commented 4 years ago

https://github.com/SeasX/SeasLog/pull/282 可以看看这个pr 是换行替换成ascii码的26了,这是个不可见字符,所以变成^Z 所以是之前的配置trim 过滤有bug

alu12138 commented 4 years ago

明白了

769344359 commented 4 years ago

trim_wrap 有bug

alu12138 commented 4 years ago

恩,一般不会加"\r\n"写入到文件里。只是老代码内容都是用这种$jsonMsg . "\r\n"拼接,之前用file_put_contents没啥问题,然后日志文件会上传阿里云emr,那边解析不了才发现有这问题。

hi-man commented 4 years ago

seaslog.trim_wrap = 1 时稳定重现这个问题 @769344359 的 #282 修复了这个问题