mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-27 18:51:34 +01:00
Add handling of inode changes to reopen files in StreamHandler (#1963)
This commit is contained in:
@@ -365,4 +365,16 @@ The exception occurred while attempting to log: test');
|
||||
ini_set('memory_limit', $previousValue);
|
||||
}
|
||||
}
|
||||
|
||||
public function testReopensFileIfInodeChanges()
|
||||
{
|
||||
$filename = __DIR__ . '/test.log';
|
||||
$handler = new StreamHandler($filename);
|
||||
$handler->setFormatter($this->getIdentityFormatter());
|
||||
$handler->handle($this->getRecord(Level::Warning, 'test1'));
|
||||
@unlink($filename);
|
||||
$handler->handle($this->getRecord(Level::Warning, 'test2'));
|
||||
$data = @file_get_contents($filename);
|
||||
$this->assertEquals('test2', $data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user