Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Modify error log string
  • hello

    all i want to ask is if it is possible to change the informations containing by log files (app/logs)

    for example currently i have this in my logs

    ERROR - 2019-11-13 02:31:29 --> Error - Unable to find template "admin/settings/security.html.twig" (looked into: /var/www/vhosts/shop/app/views/admin, /var/www/vhosts/shop/app/views, /var/www/vhosts/shop/app/views) in "settings.html.twig" at line 27. in /var/www/vhosts/shop/fuel/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 265

    and i want

    ERROR - 2019-11-13 02:31:29 - https://example.com --> Error - Unable to find template "admin/settings/security.html.twig" (looked into: /var/www/vhosts/shop/app/views/admin, /var/www/vhosts/shop/app/views, /var/www/vhosts/shop/app/views) in "settings.html.twig" at line 27. in /var/www/vhosts/shop/fuel/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 265

    inject in this case "https://example.com" to the string ..

    "https://example.com" will differ ...

    short: i need the SERVER_NAME in my error logs

    greetings & thanks

    i thought about this thing and i preffer other way

    instead of manipulate the strings of the log files i whould change the path

    instead of save logs to for example app/logs/2019/11 system should save log files to app/logs/%SERVER_NAME%/2019/11
  • Harro VertonHarro Verton
    Accepted Answer
    You can do that, by overloading Log::initialize(), and creating your own monolog handlers in static::$monolog. 

    After that, it is standard monolog stuff. We've created a custom processor, but perhaps only a modified line formatter will do the trick for you.

    See https://stackify.com/php-monolog-tutorial/ for a good tutorial on Monolog.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion