Skip to content
Snippets Groups Projects
Commit e9040dc6 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Fix LoggerFactory to handle a Windows path with drive letter properly.

parent 5d82b1a6
No related merge requests found
...@@ -116,9 +116,16 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface ...@@ -116,9 +116,16 @@ class LoggerFactory implements \Zend\ServiceManager\FactoryInterface
*/ */
protected function addFileWriters(Logger $logger, $config) protected function addFileWriters(Logger $logger, $config)
{ {
$parts = explode(':', $config); // Make sure to use only the last ':' after second character to avoid trouble
$file = $parts[0]; // with Windows drive letters (e.g. "c:\something\logfile:error-5")
$error_types = isset($parts[1]) ? $parts[1] : ''; $pos = strrpos($config, ':', 2);
if ($pos > 0) {
$file = substr($config, 0, $pos);
$error_types = substr($config, $pos + 1);
} else {
$file = $config;
$error_types = '';
}
// Make Writers // Make Writers
$filters = explode(',', $error_types); $filters = explode(',', $error_types);
......
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