Skip to content

Commit f6646c6

Browse files
committed
Merge pull request #6 from aptoma/catch-subnet-ip-error
Catch error when trying to retrieve client IP for logging purposes
2 parents 88ee1f9 + c65d139 commit f6646c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Aptoma/Log/RequestProcessor.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public function __construct(Application $app, $token = null)
3232

3333
public function __invoke(array $record)
3434
{
35-
$record['extra']['clientIp'] = $this->getClientIp($this->app['request_stack']);
35+
try {
36+
$record['extra']['clientIp'] = $this->getClientIp($this->app['request_stack']);
37+
} catch (\Exception $e) {
38+
$record['extra']['clientIp'] = '';
39+
}
3640
if ($this->app->offsetExists('security')) {
3741
$record['extra']['user'] = $this->getUsername($this->app['security']);
3842
}

0 commit comments

Comments
 (0)