Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window10 1903无法成日志文件 #280

Open
tancoder10 opened this issue Nov 13, 2019 · 10 comments
Open

window10 1903无法成日志文件 #280

tancoder10 opened this issue Nov 13, 2019 · 10 comments
Labels

Comments

@tancoder10
Copy link

tancoder10 commented Nov 13, 2019

系统: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
Copy link
Member

Linux下是正常的吗?

@769344359
Copy link
Member

@tancoder10 seaslog 版本多少?

@sunlu
Copy link

sunlu commented Mar 29, 2020

同样有此问题
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
Copy link
Member

769344359 commented Mar 29, 2020

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

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

@sunlu
Copy link

sunlu commented Mar 30, 2020

@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
Copy link
Member

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

@769344359
Copy link
Member

769344359 commented Mar 31, 2020

已复现

<?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的情况

@769344359 769344359 added the bug label Mar 31, 2020
@stone-shawn
Copy link

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

@769344359
Copy link
Member

769344359 commented May 25, 2020

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

<?php
phpinfo();

看看是使用什么sapi


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

@stone-shawn
Copy link

@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
线程安全版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants