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

使用GuzzleHttp会导致日志时间变了 #320

Open
zhoulin1359 opened this issue Apr 26, 2023 · 1 comment
Open

使用GuzzleHttp会导致日志时间变了 #320

zhoulin1359 opened this issue Apr 26, 2023 · 1 comment

Comments

@zhoulin1359
Copy link

case:

/** @noinspection PhpUndefinedClassInspection */
        SeasLog::setBasePath('./logs');
        /** @noinspection PhpUndefinedClassInspection */
        SeasLog::setLogger('test');
        SeasLog::info(sprintf('start:tz:%s,now:%s',date_default_timezone_get(),date('Y-m-d H:i:s')));
        $request = new GuzzleHttp\Psr7\Request('GET', "https://www.baidu.com/", ['User-Agent' => 'bar']);
       /* $c = new Guzzle7HttpHandler();
        $c($request);*/
        $c = new GuzzleHttp\Client();
        $c->send($request);
        sleep(1);
        SeasLog::info(sprintf('end:tz:%s,now:%s',date_default_timezone_get(),date('Y-m-d H:i:s')));

日志如下:
2023-04-26 10:09:18 | INFO | 23745 | 6448f84e0ca62 | 1682503758.168 | start:tz:PRC,now:2023-04-26 18:09:18
2023-04-26 18:09:19 | INFO | 23745 | 6448f84e0ca62 | 1682503759.572 | end:tz:PRC,now:2023-04-26 18:09:19

程序获取到的时间没问题,日志打印的时间看起来是时区变了

版本和配置:

SeasLog support => Enabled
SeasLog Version => 2.1.0
SeasLog Author => Chitao.Gao [ [email protected] ]
SeasLog Supports => https://github.com/SeasX/SeasLog

Directive => Local Value => Master Value
seaslog.default_basepath => /var/log/www => /var/log/www
seaslog.default_logger => default => default
seaslog.default_datetime_format => Y-m-d H:i:s => Y-m-d H:i:s
seaslog.default_template => %T | %L | %P | %Q | %t | %M => %T | %L | %P | %Q | %t | %M
seaslog.disting_folder => On => On
seaslog.disting_type => Off => Off
seaslog.disting_by_hour => Off => Off
seaslog.use_buffer => Off => Off
seaslog.buffer_size => 0 => 0
seaslog.buffer_disabled_in_cli => Off => Off
seaslog.trace_notice => Off => Off
seaslog.trace_warning => Off => Off
seaslog.trace_error => On => On
seaslog.trace_exception => Off => Off
seaslog.level => 8 => 8
seaslog.recall_depth => 0 => 0
seaslog.appender => 1 => 1
seaslog.appender_retry => 0 => 0
seaslog.remote_host => 127.0.0.1 => 127.0.0.1
seaslog.remote_port => 514 => 514
seaslog.remote_timeout => 1 => 1
seaslog.trim_wrap => Off => Off
seaslog.throw_exception => On => On
seaslog.ignore_warning => On => On
seaslog.trace_performance => Off => Off
seaslog.trace_performance_sample_rate => 10 => 10
seaslog.trace_performance_start_depth => 1 => 1
seaslog.trace_performance_max_depth => 5 => 5
seaslog.trace_performance_max_functions_per_depth => 5 => 5
seaslog.trace_performance_min_wall_time => 1000 => 1000
seaslog.trace_performance_min_function_wall_time => 10 => 10

@zhoulin1359
Copy link
Author

需要手动设置时间后才能复现

date_default_timezone_set('PRC');

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

No branches or pull requests

1 participant