kRi*_*cha 7 capistrano symfony monolog symfony-flex
我有网络应用程序,用symfony-flex构建,用于部署我使用capistrano.为了记录关键日志,我已经以这种方式配置了monolog:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
channels: ['!translation']
excluded_http_codes: [{ 404: ['^/security/login'] }]
handler: grouped
grouped:
type: group
members: [deduplicated]
deduplicated:
type: deduplication
handler: swift
swift:
type: swift_mailer
from_email: '%mailer_user%'
to_email: ['email1@gmail.com', 'email2@gmail.com']
subject: " %%level_name%% %%level%%"
level: info
formatter: monolog.formatter.html
content_type: text/html
Run Code Online (Sandbox Code Playgroud)
SwiftMailer配置:
swiftmailer:
url: '%env(MAILER_URL)%'
spool: { type: 'memory' }
Run Code Online (Sandbox Code Playgroud)
除了每次发布后的日志,一切正常.我收到之前发送过的旧日志.例:
也许我错过了配置中的一些东西?
处理程序类型的 MonologBundle 配置deduplication具有其他潜在参数 - 包括
store:重复数据删除日志保存的文件/路径,默认为%kernel.cache_dir%/monolog_dedup_*
它正在重新读取部署之前缓存目录中的文件。
我还使用 Capistrano 部署我的网站 - 但我不会在网站的不同部署之间共享缓存目录。我的共享文件配置是set :linked_dirs, [fetch(:log_path)]- 仅共享日志以保持长期更新。缓存目录仍在 ./var/cache 中,但它是在每次部署时新创建的。
| 归档时间: |
|
| 查看次数: |
155 次 |
| 最近记录: |