Commit 0842b0ba authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added log gathering over redis-sentinel

parent 8dde4b5d
......@@ -40,7 +40,17 @@ class AppendLogs extends Command
*/
public function handle()
{
$redis = Redis::connection('cache');
$redis = null;
if (env("REDIS_CACHE_DRIVER", "redis") === "redis") {
$redis = Redis::connection('cache');
} elseif (env("REDIS_CACHE_DRIVER", "redis") === "redis-sentinel") {
$redis = RedisSentinel::connection('cache');
}
if ($redis === null) {
Log::error("No valid Redis Connection specified");
return;
}
$elements = [];
$reply = $redis->pipeline(function ($pipe) use ($elements) {
......
......@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Redis;
use Jenssegers\Agent\Agent;
use LaravelLocalization;
use Log;
use Monospice\LaravelRedisSentinel\RedisSentinel;
use Predis\Connection\ConnectionException;
class MetaGer
......@@ -1392,12 +1393,11 @@ class MetaGer
$logEntry = preg_replace("/\n+/", " ", $logEntry);
Redis::connection('cache')->rpush(\App\Console\Commands\AppendLogs::LOGKEY, $logEntry);
/*$logpath = \App\MetaGer::getMGLogFile();
if (file_put_contents($logpath, $logEntry . PHP_EOL, FILE_APPEND) === false) {
Log::error("Konnte Log Zeile nicht schreiben");
}*/
if (env("REDIS_CACHE_DRIVER", "redis") === "redis") {
Redis::connection('cache')->rpush(\App\Console\Commands\AppendLogs::LOGKEY, $logEntry);
} elseif (env("REDIS_CACHE_DRIVER", "redis") === "redis-sentinel") {
RedisSentinel::connection('cache')->rpush(\App\Console\Commands\AppendLogs::LOGKEY, $logEntry);
}
} catch (\Exception $e) {
Log::error($e->getMessage());
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment