logging.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. use Monolog\Handler\NullHandler;
  3. use Monolog\Handler\StreamHandler;
  4. use Monolog\Handler\SyslogUdpHandler;
  5. return [
  6. /*
  7. |--------------------------------------------------------------------------
  8. | Default Log Channel
  9. |--------------------------------------------------------------------------
  10. |
  11. | This option defines the default log channel that gets used when writing
  12. | messages to the logs. The name specified in this option should match
  13. | one of the channels defined in the "channels" configuration array.
  14. |
  15. */
  16. 'default' => env('LOG_CHANNEL', 'stack'),
  17. /*
  18. |--------------------------------------------------------------------------
  19. | Deprecations Log Channel
  20. |--------------------------------------------------------------------------
  21. |
  22. | This option controls the log channel that should be used to log warnings
  23. | regarding deprecated PHP and library features. This allows you to get
  24. | your application ready for upcoming major versions of dependencies.
  25. |
  26. */
  27. 'deprecations' => [
  28. 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
  29. 'trace' => false,
  30. ],
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Log Channels
  34. |--------------------------------------------------------------------------
  35. |
  36. | Here you may configure the log channels for your application. Out of
  37. | the box, Laravel uses the Monolog PHP logging library. This gives
  38. | you a variety of powerful log handlers / formatters to utilize.
  39. |
  40. | Available Drivers: "single", "daily", "slack", "syslog",
  41. | "errorlog", "monolog",
  42. | "custom", "stack"
  43. |
  44. */
  45. 'channels' => [
  46. 'stack' => [
  47. 'driver' => 'stack',
  48. 'channels' => ['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. ],
  56. 'daily' => [
  57. 'driver' => 'daily',
  58. 'path' => storage_path('logs/laravel.log'),
  59. 'level' => env('LOG_LEVEL', 'debug'),
  60. 'days' => 14,
  61. ],
  62. 'payment' => [
  63. 'driver' => 'daily',
  64. 'path' => storage_path('logs/payment/payment.log'),
  65. 'level' => env('LOG_LEVEL', 'debug'),
  66. 'days' => 30,
  67. 'permission' => 0664,
  68. ],
  69. 'payment_error' => [
  70. 'driver' => 'daily',
  71. 'path' => storage_path('logs/payment/error.log'),
  72. 'level' => 'error',
  73. 'days' => 90,
  74. ],
  75. 'share' => [
  76. 'driver' => 'daily',
  77. 'path' => storage_path('logs/share/commission.log'),
  78. 'level' => env('LOG_LEVEL', 'debug'),
  79. 'days' => 90,
  80. 'permission' => 0664,
  81. ],
  82. 'realtime' => [
  83. 'driver' => 'daily',
  84. 'path' => storage_path('logs/realtime/admin.log'),
  85. 'level' => env('LOG_LEVEL', 'debug'),
  86. 'days' => 14,
  87. 'permission' => 0664,
  88. ],
  89. 'slack' => [
  90. 'driver' => 'slack',
  91. 'url' => env('LOG_SLACK_WEBHOOK_URL'),
  92. 'username' => 'Laravel Log',
  93. 'emoji' => ':boom:',
  94. 'level' => env('LOG_LEVEL', 'critical'),
  95. ],
  96. 'papertrail' => [
  97. 'driver' => 'monolog',
  98. 'level' => env('LOG_LEVEL', 'debug'),
  99. 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
  100. 'handler_with' => [
  101. 'host' => env('PAPERTRAIL_URL'),
  102. 'port' => env('PAPERTRAIL_PORT'),
  103. 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
  104. ],
  105. ],
  106. 'stderr' => [
  107. 'driver' => 'monolog',
  108. 'level' => env('LOG_LEVEL', 'debug'),
  109. 'handler' => StreamHandler::class,
  110. 'formatter' => env('LOG_STDERR_FORMATTER'),
  111. 'with' => [
  112. 'stream' => 'php://stderr',
  113. ],
  114. ],
  115. 'syslog' => [
  116. 'driver' => 'syslog',
  117. 'level' => env('LOG_LEVEL', 'debug'),
  118. ],
  119. 'errorlog' => [
  120. 'driver' => 'errorlog',
  121. 'level' => env('LOG_LEVEL', 'debug'),
  122. ],
  123. 'null' => [
  124. 'driver' => 'monolog',
  125. 'handler' => NullHandler::class,
  126. ],
  127. 'emergency' => [
  128. 'path' => storage_path('logs/laravel.log'),
  129. ],
  130. 'wallet' => [
  131. 'driver' => 'single',
  132. 'path' => storage_path('logs/wallet.log'),
  133. 'level' => 'info',
  134. ],
  135. 'issue' => [
  136. 'driver' => 'daily', // 改为 daily
  137. 'path' => storage_path('logs/issue.log'),
  138. 'level' => 'info',
  139. 'days' => 14, // 可选,保留最近14天的日志
  140. ],
  141. 'dblog' => [
  142. 'driver' => 'single',
  143. 'path' => storage_path('logs/dblog.log'),
  144. 'level' => 'info',
  145. 'days' => 30,
  146. ],
  147. ],
  148. ];