Ver código fonte

Add monolog config

michel 3 anos atrás
pai
commit
46befc9710
1 arquivos alterados com 81 adições e 11 exclusões
  1. 81 11
      config/packages/prod/monolog.yaml

+ 81 - 11
config/packages/prod/monolog.yaml

@@ -1,17 +1,87 @@
+# Voir doc/logging.md
 monolog:
     handlers:
-        main:
-            type: fingers_crossed
-            action_level: error
-            handler: nested_stderr
-            excluded_http_codes: [404, 405]
-            buffer_size: 50 # How many messages should be saved? Prevent memory leaks
-        nested_stderr:
+        # sorties standards (stdout, stderr, console)
+        stderr:
             type: stream
-            path: php://stderr  # Handled by the apache logging system
-            level: debug
-            formatter: monolog.formatter.json
+            path: php://stderr
+            level: error
+            channels: ["!event", "!doctrine"]
         console:
             type: console
             process_psr_3_messages: false
-            channels: ["!event", "!doctrine"]
+            level: debug
+            channels: ["!event", "!doctrine", "!console"]
+
+        # email en cas d'erreurs critiques, sauf erreurs 404 / 405
+        #        critical:
+        #            type: fingers_crossed
+        #            action_level: critical
+        #            excluded_http_codes: [ 404, 405 ]
+        #            handler: deduplicated
+        #        deduplicated:
+        #            type: deduplication
+        #            handler: mailer
+        #        mailer:
+        #            type: symfony_mailer
+        #            from_email: "process@opentalent.fr"
+        #            to_email: "exploitation@opentalent.fr"
+        #            subject: AP2I - Critical Error Occurred
+        #            level: critical
+        #            formatter: monolog.formatter.html
+        #            content_type: text/html
+
+        # logging fichier
+        file_main:
+            type: rotating_file
+            path: "%kernel.logs_dir%/%kernel.environment%.main.log"
+            level: debug
+            max_files: 3
+            channels: [php, doctrine, http_client, elastica]
+        file_auth:
+            type: rotating_file
+            path: "%kernel.logs_dir%/%kernel.environment%.auth.log"
+            level: debug
+            max_files: 3
+            channels: security
+
+        # logs spécifiques à certains process
+        # * synchro dolibarr
+        dolibarrsync:
+            type: group
+            members: [dolibarrsync_file]
+            channels: dolibarrsync
+        dolibarrsync_file:
+            type: rotating_file
+            path: "%kernel.logs_dir%/%kernel.environment%.dolibarrsync.log"
+            level: debug
+            max_files: 7
+            formatter: monolog.formatter.message
+
+        #        dolibarrsync_critical:
+        #            type:           fingers_crossed
+        #            action_level:   critical
+        #            handler:        dolibarrsync_deduplicated
+        #        dolibarrsync_deduplicated:
+        #            type: deduplication
+        #            # the time in seconds during which duplicate entries are discarded (default: 60)
+        #            time: 10
+        #            handler: dolibarrsync_mailer
+        #        dolibarrsync_mailer:
+        #            type:           symfony_mailer
+        #            from_email:     "process@opentalent.fr"
+        #            to_email:       "exploitation@opentalent.fr"
+        #            subject:        "Dolibarr Sync - Critical Error"
+        #            level:          error
+        #            formatter:      monolog.formatter.html
+        #            content_type:   text/html
+
+
+        # uncomment to get logging in your browser
+        # you may have to allow bigger header sizes in your Web server configuration
+        #firephp:
+        #    type: firephp
+        #    level: info
+        #chromephp:
+        #    type: chromephp
+        #    level: info