Skip to content

Commit 634e8b4

Browse files
authored
Merge pull request #16 from a1comms/log-fix
Logging Fix
2 parents ce67836 + 95f5d2a commit 634e8b4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/A1comms/GaeSupportLaravel/Foundation/Application.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Google\Cloud\Logging\PsrBatchLogger;
99
use Monolog\Handler\PsrHandler;
1010
use Monolog\Handler\SyslogHandler;
11+
use Monolog\Handler\StreamHandler;
1112
use A1comms\GaeSupportLaravel\Storage\Optimizer;
1213

1314
/**
@@ -73,7 +74,13 @@ public function __construct($basePath = null)
7374
});
7475
} else if ( is_gae_flex() ) {
7576
$this->configureMonologUsing(function ($monolog) {
76-
$monolog->pushHandler(new PsrHandler(new PsrBatchLogger('app')));
77+
$monolog->pushHandler(new PsrHandler('app', ['batchEnabled' => true]));
78+
});
79+
} else {
80+
$this->configureMonologUsing(function ($monolog) {
81+
$handler = new StreamHandler($this->storagePath('logs/lumen.log'));
82+
$handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
83+
$monolog->pushHandler($handler);
7784
});
7885
}
7986

src/A1comms/GaeSupportLaravel/Foundation/LumenApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function getMonologHandler()
237237
if ( is_gae_std() ) {
238238
return new SyslogHandler('intranet', 'user', Logger::DEBUG, false, LOG_PID);
239239
} else if ( is_gae_flex() ) {
240-
return new PsrHandler(new PsrBatchLogger('app'));
240+
return new PsrHandler('app', ['batchEnabled' => true]);
241241
} else {
242242
$handler = new StreamHandler($this->storagePath('logs/lumen.log'));
243243
$handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));

0 commit comments

Comments
 (0)