1
0
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:
Cesar Garcia
2025-10-23 21:12:34 +02:00
committed by GitHub
parent e1d85dbd82
commit 282b43c996
2 changed files with 43 additions and 0 deletions

View File

@@ -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);
}
}