How can we create a separate log files for all the levels by Monolog module Drupal9?

117
June 01, 2022, at 3:00 PM

How can we create a separate log files for all the levels by Monolog module Drupal9? Eg. INFO logs only in info file and Warning log in warning file?

I am using Monolog module in Drupal9. I have created monolog.services.yml inside default folder and wrote below code-

  monolog.channel_handlers: 
    php: ['error', 'notice', 'info', 'warning', 'critical', 'alert', 'emergency', 'debug']
    default: ['drupal.dblog']
  monolog.processors: ['message_placeholder', 'current_user', 'request_uri', 'ip', 'referer']
services:
  monolog.handler.error:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/error.log', 10, 'ERROR', FALSE]
  monolog.handler.notice:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/notice.log', 10, 'NOTICE', FALSE]
  monolog.handler.info:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/info.log', 10, 'INFO', FALSE]
  monolog.handler.warning:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/warning.log', 10, 'WARNING', FALSE]
  monolog.handler.critical:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/critical.log', 10, 'CRITICAL', FALSE] 
  monolog.handler.alert:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/alert.log', 10, 'ALERT', FALSE] 
  monolog.handler.emergency:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/emergency.log', 10, 'EMERGENCY', FALSE]
  monolog.handler.debug:
    class: Monolog\Handler\RotatingFileHandler
    arguments: ['private://logs/debug.log', 10, 'DEBUG', FALSE] 

But it doesn't work. Logs are not written in separate log files as per the log level.

Rent Charter Buses Company
READ ALSO
How to Recursively find secondary profiles and merge into primary one

How to Recursively find secondary profiles and merge into primary one

I have a sample array, in which I would like to find the secondary ones and recursively check the secondary one until all secondary profiles gets unset from PHP arrayHere is the example array

72
How do I write my code in a way that when my containers are deployed as Rancher workloads they can communicate?

How do I write my code in a way that when my containers are deployed as Rancher workloads they can communicate?

I have been using Docker to containerise a simple PHP web app that connects to and uses a mySQL database to pull data fromIt also includes phpmyadmin as a UI for the management of the database

136
Invalid argument supplied for foreach()

Invalid argument supplied for foreach()

It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data

124
Fetch Api unable to add and update php cart session

Fetch Api unable to add and update php cart session

I am new to Nextjs and have been trying to connect to a cart session in a PHP file hosting at localhost/aits from the Next

89