logging.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. use Monolog\Handler\NullHandler;
  3. use Monolog\Handler\StreamHandler;
  4. use Monolog\Handler\SyslogUdpHandler;
  5. use Monolog\Processor\PsrLogMessageProcessor;
  6. return [
  7. /*
  8. |--------------------------------------------------------------------------
  9. | Default Log Channel
  10. |--------------------------------------------------------------------------
  11. |
  12. | This option defines the default log channel that is utilized to write
  13. | messages to your logs. The value provided here should match one of
  14. | the channels present in the list of "channels" configured below.
  15. |
  16. */
  17. 'default' => env('LOG_CHANNEL', 'stack'),
  18. /*
  19. |--------------------------------------------------------------------------
  20. | Deprecations Log Channel
  21. |--------------------------------------------------------------------------
  22. |
  23. | This option controls the log channel that should be used to log warnings
  24. | regarding deprecated PHP and library features. This allows you to get
  25. | your application ready for upcoming major versions of dependencies.
  26. |
  27. */
  28. 'deprecations' => [
  29. 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
  30. 'trace' => env('LOG_DEPRECATIONS_TRACE', false),
  31. ],
  32. /*
  33. |--------------------------------------------------------------------------
  34. | Log Channels
  35. |--------------------------------------------------------------------------
  36. |
  37. | Here you may configure the log channels for your application. Laravel
  38. | utilizes the Monolog PHP logging library, which includes a variety
  39. | of powerful log handlers and formatters that you're free to use.
  40. |
  41. | Available drivers: "single", "daily", "slack", "syslog",
  42. | "errorlog", "monolog", "custom", "stack"
  43. |
  44. */
  45. 'channels' => [
  46. 'stack' => [
  47. 'driver' => 'stack',
  48. 'channels' => explode(',', env('LOG_STACK', 'single')),
  49. 'ignore_exceptions' => false,
  50. ],
  51. 'single' => [
  52. 'driver' => 'single',
  53. 'path' => storage_path('logs/laravel.log'),
  54. 'level' => env('LOG_LEVEL', 'debug'),
  55. 'replace_placeholders' => true,
  56. ],
  57. 'daily' => [
  58. 'driver' => 'daily',
  59. 'path' => storage_path('logs/laravel.log'),
  60. 'level' => env('LOG_LEVEL', 'debug'),
  61. 'days' => env('LOG_DAILY_DAYS', 14),
  62. 'replace_placeholders' => true,
  63. 'permission' => 0777,
  64. ],
  65. 'size_rotating_daily' => [
  66. 'driver' => 'size_rotating_daily',
  67. 'path' => storage_path('logs/laravel.log'),
  68. 'level' => env('LOG_LEVEL', 'debug'),
  69. 'days' => env('LOG_DAILY_DAYS', default: 3),
  70. 'max_file_size' => env('LOG_MAX_FILE_SIZE', '1000K'),
  71. 'permission' => 0777,
  72. 'locking' => false,
  73. 'replace_placeholders' => true,
  74. ],
  75. 'slack' => [
  76. 'driver' => 'slack',
  77. 'url' => env('LOG_SLACK_WEBHOOK_URL'),
  78. 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
  79. 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
  80. 'level' => env('LOG_LEVEL', 'critical'),
  81. 'replace_placeholders' => true,
  82. ],
  83. 'papertrail' => [
  84. 'driver' => 'monolog',
  85. 'level' => env('LOG_LEVEL', 'debug'),
  86. 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
  87. 'handler_with' => [
  88. 'host' => env('PAPERTRAIL_URL'),
  89. 'port' => env('PAPERTRAIL_PORT'),
  90. 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
  91. ],
  92. 'processors' => [PsrLogMessageProcessor::class],
  93. ],
  94. 'stderr' => [
  95. 'driver' => 'monolog',
  96. 'level' => env('LOG_LEVEL', 'debug'),
  97. 'handler' => StreamHandler::class,
  98. 'formatter' => env('LOG_STDERR_FORMATTER'),
  99. 'with' => [
  100. 'stream' => 'php://stderr',
  101. ],
  102. 'processors' => [PsrLogMessageProcessor::class],
  103. ],
  104. 'syslog' => [
  105. 'driver' => 'syslog',
  106. 'level' => env('LOG_LEVEL', 'debug'),
  107. 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
  108. 'replace_placeholders' => true,
  109. ],
  110. 'errorlog' => [
  111. 'driver' => 'errorlog',
  112. 'level' => env('LOG_LEVEL', 'debug'),
  113. 'replace_placeholders' => true,
  114. ],
  115. 'null' => [
  116. 'driver' => 'monolog',
  117. 'handler' => NullHandler::class,
  118. ],
  119. 'emergency' => [
  120. 'path' => storage_path('logs/laravel.log'),
  121. ]
  122. ],
  123. ];