作者 赵彬吉

update

@@ -32,8 +32,7 @@ class LogFormatterFactory @@ -32,8 +32,7 @@ class LogFormatterFactory
32 $path = date('Y-m', $time) . '/' . date('d', $time) . '_' . $suffix . '.log'; 32 $path = date('Y-m', $time) . '/' . date('d', $time) . '_' . $suffix . '.log';
33 $path = 'logs/' . $config['prefix'] . '/' . $path; 33 $path = 'logs/' . $config['prefix'] . '/' . $path;
34 $path = storage_path($path); 34 $path = storage_path($path);
35 - $handler = new StreamHandler($path, $level, false);  
36 - $handler->setFormatter(new LineFormatter(null, 'Y-m-d H:i:s', false, true)); 35 +
37 try { 36 try {
38 $owner = posix_getpwuid(fileowner($path)); 37 $owner = posix_getpwuid(fileowner($path));
39 if($owner['name'] !== 'www'){ 38 if($owner['name'] !== 'www'){
@@ -41,6 +40,9 @@ class LogFormatterFactory @@ -41,6 +40,9 @@ class LogFormatterFactory
41 } 40 }
42 }catch (\Throwable $exception){} 41 }catch (\Throwable $exception){}
43 42
  43 + $handler = new StreamHandler($path, $level, false);
  44 + $handler->setFormatter(new LineFormatter(null, 'Y-m-d H:i:s', false, true));
  45 +
44 return $handler; 46 return $handler;
45 } 47 }
46 48