CodeIgniter Forums
Redirecting logging output - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Redirecting logging output (/showthread.php?tid=76285)



Redirecting logging output - richb201 - 04-29-2020

I am using Docker and they recommend to send logging output to STDOUT or the console so that the "docker container logs" command can be used. Is there some easy way to redirect the logging output?


RE: Redirecting logging output - richb201 - 05-01-2020

I thought this would be an easy question. I guess not.


RE: Redirecting logging output - jjinkou2 - 08-24-2020

i have done that like this.
I wrote a hanlder base upon the filehandler then i change the config to add this handler
1) first the handler
i copied the system/log/filehandler.php to system/log/stderrhandler.php
I removed everything concerning the file.
i added "echo $msg" inside the function handle.

2) the config
inside the app/Config/Logger.php i added my new handler
Codeingiter\Log\Handlers\stderrhandler =>[handles ...] (just copy it from the chromehandler