logging.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. ],
  64. 'slack' => [
  65. 'driver' => 'slack',
  66. 'url' => env('LOG_SLACK_WEBHOOK_URL'),
  67. 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
  68. 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
  69. 'level' => env('LOG_LEVEL', 'critical'),
  70. 'replace_placeholders' => true,
  71. ],
  72. 'papertrail' => [
  73. 'driver' => 'monolog',
  74. 'level' => env('LOG_LEVEL', 'debug'),
  75. 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
  76. 'handler_with' => [
  77. 'host' => env('PAPERTRAIL_URL'),
  78. 'port' => env('PAPERTRAIL_PORT'),
  79. 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
  80. ],
  81. 'processors' => [PsrLogMessageProcessor::class],
  82. ],
  83. 'stderr' => [
  84. 'driver' => 'monolog',
  85. 'level' => env('LOG_LEVEL', 'debug'),
  86. 'handler' => StreamHandler::class,
  87. 'formatter' => env('LOG_STDERR_FORMATTER'),
  88. 'with' => [
  89. 'stream' => 'php://stderr',
  90. ],
  91. 'processors' => [PsrLogMessageProcessor::class],
  92. ],
  93. 'syslog' => [
  94. 'driver' => 'syslog',
  95. 'level' => env('LOG_LEVEL', 'debug'),
  96. 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
  97. 'replace_placeholders' => true,
  98. ],
  99. 'errorlog' => [
  100. 'driver' => 'errorlog',
  101. 'level' => env('LOG_LEVEL', 'debug'),
  102. 'replace_placeholders' => true,
  103. ],
  104. 'null' => [
  105. 'driver' => 'monolog',
  106. 'handler' => NullHandler::class,
  107. ],
  108. 'emergency' => [
  109. 'path' => storage_path('logs/laravel.log'),
  110. ],
  111. ],
  112. ];