[Zope3-checkins] SVN: Zope3/trunk/ Expose the logger section as a multisection in zope.conf, so one can define loggers for specific subsystems. Also provide an example logger in zope.conf.in

Martijn Pieters mj at zopatista.com
Mon Aug 28 10:34:00 EDT 2006


Log message for revision 69809:
  Expose the logger section as a multisection in zope.conf, so one can define loggers for specific subsystems. Also provide an example logger in zope.conf.in

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/appsetup/schema.xml
  U   Zope3/trunk/src/zope/app/server/main.py
  U   Zope3/trunk/src/zope/app/twisted/main.py
  U   Zope3/trunk/zopeskel/etc/zope.conf.in

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-08-27 19:53:26 UTC (rev 69808)
+++ Zope3/trunk/doc/CHANGES.txt	2006-08-28 14:33:58 UTC (rev 69809)
@@ -19,6 +19,9 @@
       - New Dublin Core property object that allows scalar treatment for
         sequence types. Made it work with both Tuple and List field type.
 
+      - New logger directive for zope.conf allows for configuring loggers
+        for specific subsystems with their own level and handlers.
+
     Restructuring
 
     Bug fixes

Modified: Zope3/trunk/src/zope/app/appsetup/schema.xml
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/schema.xml	2006-08-27 19:53:26 UTC (rev 69808)
+++ Zope3/trunk/src/zope/app/appsetup/schema.xml	2006-08-28 14:33:58 UTC (rev 69809)
@@ -34,6 +34,12 @@
       Configuration for the eventlog.
     </description>
   </section>
+  
+  <multisection type="logger" attribute="loggers" name="*" required="no">
+    <description>
+      Additional loggers for specific subsystems
+    </description>
+  </multisection>
 
   <key name="site-definition" default="site.zcml">
     <description>

Modified: Zope3/trunk/src/zope/app/server/main.py
===================================================================
--- Zope3/trunk/src/zope/app/server/main.py	2006-08-27 19:53:26 UTC (rev 69808)
+++ Zope3/trunk/src/zope/app/server/main.py	2006-08-28 14:33:58 UTC (rev 69809)
@@ -97,6 +97,8 @@
 
     options.eventlog()
     options.accesslog()
+    for logger in options.logger:
+        logger()
 
     features = ('zserver',)
     # Provide the devmode, if activated

Modified: Zope3/trunk/src/zope/app/twisted/main.py
===================================================================
--- Zope3/trunk/src/zope/app/twisted/main.py	2006-08-27 19:53:26 UTC (rev 69808)
+++ Zope3/trunk/src/zope/app/twisted/main.py	2006-08-28 14:33:58 UTC (rev 69809)
@@ -123,6 +123,8 @@
 
     options.eventlog()
     options.accesslog()
+    for logger in options.loggers:
+        logger()
 
     # Setup the logs. Eventually this might be better done using utilities.
     twisted.python.log.addObserver(log.PythonLoggingObserver())

Modified: Zope3/trunk/zopeskel/etc/zope.conf.in
===================================================================
--- Zope3/trunk/zopeskel/etc/zope.conf.in	2006-08-27 19:53:26 UTC (rev 69808)
+++ Zope3/trunk/zopeskel/etc/zope.conf.in	2006-08-28 14:33:58 UTC (rev 69809)
@@ -109,6 +109,26 @@
   </logfile>
 </eventlog>
 
+# Additional logger directives can be defined to log specific subsystem log
+# entries to their own handlers, e.g.:
+# <logger>
+#   name foo.bar
+#   propagate no
+#   level debug
+#
+#   <logfile>
+#     path $LOGDIR/foo_bar.log
+#     formatter zope.exceptions.log.Formatter
+#   </logfile>
+#
+#   <email-notifier>
+#     level critical
+#     from foo_bar_log at example.com
+#     to pager_foo_bar at example.com
+#     subject Foo Bar critical log message
+#   </email-notifier>
+# </logger>
+
 # devmode
 #
 #   Switches the Developer Mode on and off.



More information about the Zope3-Checkins mailing list