I'm using this package in background jobs. I'm getting this error
file_put_contents(/storage/logs/sql/2020-10-21-log.sql): failed to open stream: Too many open files in /vendor/mnabialek/laravel-sql-logger/src/SqlLogger.php:179
Any help on how to solve this.
I feel this could be an error reason. We should create a singleton on the SqlLogger object
//In Package ServiceProvider.php
if ($logStatus || $slowLogStatus) {
// create logger class
$logger = new SqlLogger($this->app, $logStatus, $slowLogStatus, $slowLogTime, $override,
$directory, $convertToSeconds, $separateConsoleLog);
// listen to database queries
$this->app['db']->listen(function (
$query,
$bindings = null,
$time = null
) use ($logger) {
$logger->log($query, $bindings, $time);
});
}
Thank you for reporting. I don't think making singleton would help but you should do 2 things:
Please upgrade package to latest 2.* version
Verify your system settings https://stackoverflow.com/a/14749074/3593996 - if your system is making a lot of disk operations, you should increase this limit to avoid similar errors
I'm using this package in background jobs. I'm getting this error
file_put_contents(/storage/logs/sql/2020-10-21-log.sql): failed to open stream: Too many open files in /vendor/mnabialek/laravel-sql-logger/src/SqlLogger.php:179
Any help on how to solve this.
I feel this could be an error reason. We should create a singleton on the
SqlLogger
objectPhp version: 7.3 Laravel version: 5.4 Package version: 1.1.4,