File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -32,3 +32,36 @@ Provides logging and email notifications for Laravel console commands.
32
32
` ` `
33
33
34
34
3. Now your command is... To be continued...
35
+
36
+ # # Logger is not initialized?
37
+
38
+ Please note, that ` Loggable` trait is overriding ` initialize` method:
39
+ ` ` ` php
40
+ trait Loggable
41
+ {
42
+ protected function initialize(InputInterface $input , OutputInterface $output )
43
+ {
44
+ $this->initializeLogging ();
45
+ }
46
+
47
+ // ...
48
+ }
49
+ ` ` `
50
+
51
+ If your command is overriding ` initialize` method too, then you should initialize logger manually:
52
+ ` ` ` php
53
+ class Foo extends Command
54
+ {
55
+ use Loggable;
56
+
57
+ protected function initialize(InputInterface $input , OutputInterface $output )
58
+ {
59
+ $this -> bar = $this -> argument(' bar' );
60
+ $this -> baz = $this -> argument(' baz' );
61
+
62
+ $this->initializeLogging ();
63
+ }
64
+
65
+ // ...
66
+ }
67
+ ` ` `
You can’t perform that action at this time.
0 commit comments