@@ -14,7 +14,8 @@ Log::config('404', [
14
14
]);
15
15
```
16
16
17
- Make sure your other log configs are scope-deactivated then to prevent them being logged twice:
17
+ Make sure your other log configs are scope-deactivated then to prevent them being
18
+ logged twice (` config/app.php ` ):
18
19
``` php
19
20
'Log' => [
20
21
'debug' => [
@@ -28,7 +29,8 @@ Make sure your other log configs are scope-deactivated then to prevent them bein
28
29
],
29
30
```
30
31
31
- In your bootstrap, the following snippet just needs to include the ErrorHandler of this plugin:
32
+ In your ` config/bootstrap.php ` , the following snippet just needs to include the
33
+ ErrorHandler of this plugin:
32
34
``` php
33
35
// Switch Cake\Error\ErrorHandler to
34
36
use Tools\Error\ErrorHandler;
@@ -40,7 +42,7 @@ if ($isCli) {
40
42
}
41
43
```
42
44
43
- Also, if you use the new Application middleware, make sure to include it there :
45
+ Also, make sure to switch out the middleware :
44
46
``` php
45
47
use Cake\Http\BaseApplication;
46
48
// Switch Cake\Error\Middleware\ErrorHandlerMiddleware to
@@ -67,6 +69,19 @@ Note that internally caused 404s (referrer is a page on the own site) are not tr
67
69
In that case you are having invalid links in your pages somewhere, which should be fixed.
68
70
So those are considered actual errors here.
69
71
72
+ ### Adding more exceptions
73
+
74
+ In case you need custom 404 mappings for some additional custom exceptions,
75
+ make use of ` log404 ` option in your ` app.php ` .
76
+ It will overwrite the current defaults completely.
77
+ ``` php
78
+ 'Error' => [
79
+ 'log404' => [
80
+ ... // List of FQCN class names
81
+ ],
82
+ ],
83
+ ```
84
+
70
85
### Tips
71
86
72
87
You can also set up a monitor to check for the internal 404s and alert (via email or alike).
0 commit comments