2011-05-13 65 views

回答

5

配置邮件记录器在http://pypi.python.org/pypi/plone.recipe.zope2instance被证明,但我认为,电子邮件日志通知被内置到最近Zope2释放,所以你现在应该添加以下内容你[instance]部分:

event-log-custom = 
    <email-notifier> 
    from [email protected] 
    to [email protected] 
    subject "anything goes here" 
    smtp-server 127.0.0.1 
    </email-notifier> 

(例如从http://myzope.kedai.com.my/blogs/kedai/44

+0

我试过这个我的日志文件消失 - 他们不再在var/log – scarba05 2011-10-20 07:33:42

+0

@ scarba05:请参阅关于此问题的另一个答案,其中日志文件被保留:http://stackoverflow.com/a/7832569/100297 – 2012-03-20 19:22:33

11

您可以轻松配置Zope的内置电子邮件通知,但我们发现添加mailinglogger包使得电子邮件更易于管理。

包补充说:

的电子邮件
  • 定制和动态主题行发送带有可配置的头部信息以易于筛选
  • 防洪,保证发送的电子邮件数量
  • 电子邮件也不为过
  • 支持需要验证的SMTP服务器
  • 可配置的日志条目过滤

plone.recipe.zope2instance扩展配方支持开箱即用的邮件记录器;只需在您[instance]部分定义一个变量mailinglogger和包括mailinglogger鸡蛋:

[instance] 
recipe = plone.recipe.zope2instance 
eggs += 
    mailinglogger 
# Other options go here 
mailinglogger = 
    <mailing-logger> 
    level warning 
    flood-level 100000 
    smtp-server localhost 
    from [email protected] 
    to [email protected] 
    subject [ServerName Error] [%(hostname)s] %(levelname)s - %(line)s 
    </mailing-logger> 

包已经非常宝贵的我们更大的集群,在那里我们配置每个实例的其他变量将包括在主题;我们可以看到直接在主题中发生了什么问题。

+0

邮寄记录器是否接受多个地址? – 2012-03-20 16:57:15

+0

显然只是增加更多的字段 – 2012-03-20 16:58:15

+0

http://packages.python.org/mailinglogger/zconfig.html#mailinglogger – 2012-03-20 17:05:08

2

您需要在buildout.cfg中为您的事件日志自定义添加电子邮件通知程序。不幸的是有没有办法将其追加到现有的日志记录配置,但下面将模仿的事件日志做什么plone.recipe.zope2instance反正

event-log-custom = 
    <logfile> 
    path ${buildout:directory}/var/log/${:_buildout_section_name_}.log 
    level INFO 
    </logfile> 
    <email-notifier> 
    from [email protected] 
    to [email protected] 
    subject "[Zope alert - ${:_buildout_section_name_}]" 
    smtp-server localhost 
    level error 
    </email-notifier>