logging.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. use Monolog\Handler\NullHandler;
  3. use Monolog\Handler\StreamHandler;
  4. use Monolog\Handler\SyslogUdpHandler;
  5. $hostname = gethostname();
  6. return [
  7. /*
  8. |--------------------------------------------------------------------------
  9. | Default Log Channel
  10. |--------------------------------------------------------------------------
  11. |
  12. | This option defines the default log channel that gets used when writing
  13. | messages to the logs. The name specified in this option should match
  14. | one of the channels defined in the "channels" configuration array.
  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' => false,
  31. ],
  32. /*
  33. |--------------------------------------------------------------------------
  34. | Log Channels
  35. |--------------------------------------------------------------------------
  36. |
  37. | Here you may configure the log channels for your application. Out of
  38. | the box, Laravel uses the Monolog PHP logging library. This gives
  39. | you a variety of powerful log handlers / formatters to utilize.
  40. |
  41. | Available Drivers: "single", "daily", "slack", "syslog",
  42. | "errorlog", "monolog",
  43. | "custom", "stack"
  44. |
  45. */
  46. 'channels' => [
  47. 'stack' => [
  48. 'driver' => 'stack',
  49. 'channels' => ['daily'],
  50. 'ignore_exceptions' => false,
  51. ],
  52. 'single' => [
  53. 'driver' => 'single',
  54. 'path' => storage_path('logs/laravel.log'),
  55. 'level' => env('LOG_LEVEL', 'debug'),
  56. ],
  57. 'daily' => [
  58. 'driver' => 'daily',
  59. 'path' => storage_path('logs/laravel.log'),
  60. 'level' => env('LOG_LEVEL', 'debug'),
  61. 'days' => 14,
  62. ],
  63. 'slack' => [
  64. 'driver' => 'slack',
  65. 'url' => env('LOG_SLACK_WEBHOOK_URL'),
  66. 'username' => 'Laravel Log',
  67. 'emoji' => ':boom:',
  68. 'level' => env('LOG_LEVEL', 'critical'),
  69. ],
  70. 'papertrail' => [
  71. 'driver' => 'monolog',
  72. 'level' => env('LOG_LEVEL', 'debug'),
  73. 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
  74. 'handler_with' => [
  75. 'host' => env('PAPERTRAIL_URL'),
  76. 'port' => env('PAPERTRAIL_PORT'),
  77. 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
  78. ],
  79. ],
  80. 'stderr' => [
  81. 'driver' => 'monolog',
  82. 'level' => env('LOG_LEVEL', 'debug'),
  83. 'handler' => StreamHandler::class,
  84. 'formatter' => env('LOG_STDERR_FORMATTER'),
  85. 'with' => [
  86. 'stream' => 'php://stderr',
  87. ],
  88. ],
  89. 'syslog' => [
  90. 'driver' => 'syslog',
  91. 'level' => env('LOG_LEVEL', 'debug'),
  92. ],
  93. 'errorlog' => [
  94. 'driver' => 'errorlog',
  95. 'level' => env('LOG_LEVEL', 'debug'),
  96. ],
  97. 'null' => [
  98. 'driver' => 'monolog',
  99. 'handler' => NullHandler::class,
  100. ],
  101. 'emergency' => [
  102. 'path' => storage_path('logs/laravel.log'),
  103. ],
  104. ],
  105. ];