fix(legacy): log errors on connect check failure (#2317)

This commit is contained in:
Jonas L 2022-12-16 19:07:38 +01:00
parent 5bdb2628b1
commit d9fe7d8712
2 changed files with 19 additions and 9 deletions

View File

@ -88,7 +88,9 @@ function checkDatabaseConfiguration()
// wrong, the database is improperly configured // wrong, the database is improperly configured
Propel::getConnection(); Propel::getConnection();
Propel::close(); Propel::close();
} catch (Exception $e) { } catch (Exception $exc) {
Logging::error($exc->getMessage());
return false; return false;
} }
@ -112,6 +114,7 @@ function checkRMQConnection()
{ {
$config = Config::getConfig(); $config = Config::getConfig();
try {
$conn = new \PhpAmqpLib\Connection\AMQPStreamConnection( $conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
$config['rabbitmq']['host'], $config['rabbitmq']['host'],
$config['rabbitmq']['port'], $config['rabbitmq']['port'],
@ -121,6 +124,11 @@ function checkRMQConnection()
); );
return isset($conn); return isset($conn);
} catch (\PhpAmqpLib\Exception\AMQPRuntimeException $exc) {
Logging::error($exc->getMessage());
return false;
}
} }
/** /**

View File

@ -5,3 +5,5 @@ require_once __DIR__ . '/configs/constants.php';
require_once VENDOR_PATH . '/autoload.php'; require_once VENDOR_PATH . '/autoload.php';
require_once CONFIG_PATH . '/conf.php'; require_once CONFIG_PATH . '/conf.php';
Logging::setLogPath(LIBRETIME_LOG_FILEPATH);