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

Log file created with tomorrow's date #458

Closed
edalzell opened this Issue Feb 20, 2016 · 17 comments

Comments

Projects
None yet
3 participants
@edalzell

edalzell commented Feb 20, 2016

Steps to reproduce

  1. Make Statamic generate an error, and therefore an error log
  2. Look at the file name

Expected behaviour

Filename should have todays date

Actual behaviour

logs 2016-02-19 20-31-40

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 20, 2016

My timezone is set properly

phpinfo 2016-02-19 20-42-03

edalzell commented Feb 20, 2016

My timezone is set properly

phpinfo 2016-02-19 20-42-03

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Feb 22, 2016

Member

Is your timezone set in system.yaml ?

Member

jasonvarga commented Feb 22, 2016

Is your timezone set in system.yaml ?

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 22, 2016

Yes, timezone: America/Vancouver

edalzell commented Feb 22, 2016

Yes, timezone: America/Vancouver

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Apr 8, 2016

Looks fine right now.

edalzell commented Apr 8, 2016

Looks fine right now.

@edalzell edalzell closed this Apr 8, 2016

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Apr 10, 2016

Happening on my live site

edalzell commented Apr 10, 2016

Happening on my live site

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Sep 6, 2016

Regarding #927, if I set the timezone in my settings, the actually message is timestamped correctly but the file is created incorrectly.

Which means, that if I don't have the timezone set it is NOT using the right PHP default, which should be date.timezone.

edalzell commented Sep 6, 2016

Regarding #927, if I set the timezone in my settings, the actually message is timestamped correctly but the file is created incorrectly.

Which means, that if I don't have the timezone set it is NOT using the right PHP default, which should be date.timezone.

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Sep 15, 2016

I don't have the timezone set in my system.yaml and your boot loader uses that:

        // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));

edalzell commented Sep 15, 2016

I don't have the timezone set in my system.yaml and your boot loader uses that:

        // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));

@jackmcdade jackmcdade closed this Feb 1, 2017

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 1, 2017

This still occurs for me...

edalzell commented Feb 1, 2017

This still occurs for me...

@jackmcdade

This comment has been minimized.

Show comment
Hide comment
@jackmcdade

jackmcdade Feb 1, 2017

Member

Alrighty.

Member

jackmcdade commented Feb 1, 2017

Alrighty.

@jackmcdade jackmcdade reopened this Feb 1, 2017

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 2, 2017

See name of file and screenshot.

statamic-2017-02-02.log.zip

edalzell commented Feb 2, 2017

See name of file and screenshot.

statamic-2017-02-02.log.zip

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell commented Feb 2, 2017

system yaml - v2 - sitesv2 2017-02-01 20-38-05

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 2, 2017

OK more debugging:

   protected function registerStreamHandler($config)
    {
        dd(date_default_timezone_get());

Produces UTC. So this is being called either before the boot loader that sets it, or, default timezone gets reset by the time it's called here.

edalzell commented Feb 2, 2017

OK more debugging:

   protected function registerStreamHandler($config)
    {
        dd(date_default_timezone_get());

Produces UTC. So this is being called either before the boot loader that sets it, or, default timezone gets reset by the time it's called here.

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 2, 2017

Yup, Logging is done in app.php, line 68:

$app->configureMonologUsing(function($monolog) {
    new Statamic\Logging\LoggingHandler($monolog);
});

Which I suspect is before this gets called:

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     */
    public function boot()
    {
        // Set the site's locale
        site_locale(LOCALE);

        // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));

edalzell commented Feb 2, 2017

Yup, Logging is done in app.php, line 68:

$app->configureMonologUsing(function($monolog) {
    new Statamic\Logging\LoggingHandler($monolog);
});

Which I suspect is before this gets called:

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     */
    public function boot()
    {
        // Set the site's locale
        site_locale(LOCALE);

        // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));
@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Feb 2, 2017

Just move this code:

       // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));

To app.php.

edalzell commented Feb 2, 2017

Just move this code:

       // Set the timezone. Override Laravel's config, and set in PHP
        config(['app.timezone' => Config::get('system.timezone')]);
        date_default_timezone_set(config('app.timezone'));

To app.php.

@jackmcdade

This comment has been minimized.

Show comment
Hide comment
@jackmcdade

jackmcdade Mar 16, 2017

Member

Unfortunately I spoke too soon. It's not working yet...

Member

jackmcdade commented Mar 16, 2017

Unfortunately I spoke too soon. It's not working yet...

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 17, 2017

Member

I could never replicate the behavior of the future logs, but at the location in @edalzell 's comment, the right timezone is now reflected.

Member

jasonvarga commented Mar 17, 2017

I could never replicate the behavior of the future logs, but at the location in @edalzell 's comment, the right timezone is now reflected.

@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Mar 17, 2017

for you @jasonvarga, you'd have to have no log file and try it after 7pm your time I think, in order to get the next days date.

edalzell commented Mar 17, 2017

for you @jasonvarga, you'd have to have no log file and try it after 7pm your time I think, in order to get the next days date.

@jasonvarga jasonvarga closed this Mar 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment