mnabialek / laravel-sql-logger

Log SQL queries for Laravel/Lumen framework
MIT License
156 stars 24 forks source link

Logs #4

Closed 89gsc closed 8 years ago

89gsc commented 8 years ago

Gave log directory 777 permissions and owner / group is correct but I only get errors about being unable to create the file.

Is there anyway to set the file name to something like sql.log so I can manually make the file so this isn't happening.

mnabialek commented 8 years ago

At the moment it's not possible, maybe in future versions will be. However it seems to be a problem with your server permissions. Probably your www user is not the same as user you are logged in console and that's why you are getting those errors.

klaravel commented 8 years ago

When "sql" directory in log folder is not there it's generating error.

Either if we create manually or I have clone this package and added below code in beginning of function and working great.

File: https://github.com/mnabialek/laravel-sql-logger/blob/master/src/SqlLogger.php Function: saveLog

if (!file_exists($this->directory)) {
   mkdir($this->directory, 0777, true);
}
mnabialek commented 8 years ago

This is expected behaviour. You need to create directory manually. We don't want to check if directory exists each time because of performance