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

window10 1903无法成日志文件 #280

Open tancoder10 opened 4 years ago

tancoder10 commented 4 years ago

系统:window10 1903 php: PHP Version 7.3.10 代码: `<?php file_put_contents("D://logs/default/a.log", "今天我站在年轻的战场" . PHP_EOL, FILE_APPEND);

    \SeasLog::setBasePath('D://logs');

    \SeasLog::info('test');

    \SeasLog::flushBuffer();

    var_dump(\SeasLog::getBuffer());

?>` 代码执行后 D://logs/default/a.log 文件有生成成功,文件中内容正确 但seaslog的日志末生成,D://logs/default/20191113.log此文件末生成 var_dump(\SeasLog::getBuffer()) 输出内容是 array(1) { ["D://logs/default/20191113.log"]=> array(1) { [0]=> string(74) "2019-11-13 12:10:31 | INFO | 88056 | 5dcb8236e9596 | 1573618231.81 | test " } }

769344359 commented 4 years ago

Linux下是正常的吗?

769344359 commented 4 years ago

@tancoder10 seaslog 版本多少?

sunlu commented 4 years ago

同样有此问题 array (size=1) '\writable\logs/default/20200329.log�' => array (size=3) 0 => string '2020-03-29 18:12:11 | DEBUG | 40136 | 5e80c8db922b3 | 1585498331.641 | this is a neeke debug ' (length=93) 1 => string '2020-03-29 18:12:11 | INFO | 40136 | 5e80c8db922b3 | 1585498331.641 | this is a info log ' (length=89) 2 => string '2020-03-29 18:12:11 | NOTICE | 40136 | 5e80c8db922b3 | 1585498331.641 | this is a notice log ' (length=93)

在文件路径后有一乱码造成?

769344359 commented 4 years ago

@sunlu 明天看看 ,可以描述一些配置码? 扩展版本 , php 版本

描述一下操作步骤和相关代码

sunlu commented 4 years ago

@sunlu 明天看看 ,可以描述一些配置码? 扩展版本 , php 版本

描述一下操作步骤和相关代码

系统: Windows 10 x64 PHP: 7.3.11 x64 TS Seaslog: 2.1.0 2.0.2版都有测试不行

php.ini 配置: [SeasLog] extension = seaslog

测试代码: \SeasLog::setBasePath('D://logs'); \SeasLog::info('test'); \SeasLog::flushBuffer(); var_dump(\SeasLog::getBuffer());

日志目录有自动新建,但目录内日志文件。

769344359 commented 4 years ago

@hy0kl 方便加一下微信吗? 我微信账号a769344359 感觉我这边不太好复现

769344359 commented 4 years ago

已复现

<?php
\SeasLog::info('this is a info log');

\SeasLog::notice('this is a notice log');

\SeasLog::flushBuffer();

var_dump(\SeasLog::getBuffer());

访问方式 php-7.3 ts 版本 使用xampp , xampp默认的sapi是Apache handler 。 换成 nginx+php-cgi 是正常的 表现的错误为 phpinfo()里面 seas.use_buff 是off 但是调用函数isenabledbuff 是true。 晚点会看看代码


如果是非生产环境可以使用 \SeasLog::flushBuffer(); 添加参数 0临时解决

\SeasLog::flushBuffer(0);

暂时只能大概确定是window下Apachehandler 会出现phpinfo()上展示seaslog.use_buffer是off而 调用函数 var_dump(SeasLog::getBufferEnabled()); 返回true的情况

stone-shawn commented 4 years ago

我也有这个问题,期待早日解决,暂时先用monolog

769344359 commented 4 years ago

@stone-shawn 请问你的是Apache handler 的吗?

<?php
phpinfo();

看看是使用什么sapi


可以描述一下是什么sapi 吗? fpm + nginx 还是Apache hadler ? 线程安全还是非线程安全的版本?

stone-shawn commented 4 years ago

@stone-shawn 请问你的是Apache handler 的吗?

<?php
phpinfo();

看看是使用什么sapi

可以描述一下是什么sapi 吗? fpm + nginx 还是Apache hadler ? 线程安全还是非线程安全的版本?


XAMPP 3.2.2 系统: Windows 10 x64 PHP 7.2.5 (cli) (built: Apr 25 2018 02:39:21) ( ZTS MSVC15 (Visual C++ 2017) x86 ) Apache handler 线程安全版本