[Zope-Checkins] SVN: Zope/trunk/lib/python/App/ zLOG -> logging

Andreas Jung andreas at andreas-jung.com
Sun Jan 8 05:47:26 EST 2006


Log message for revision 41197:
  zLOG -> logging

Changed:
  U   Zope/trunk/lib/python/App/ApplicationManager.py
  U   Zope/trunk/lib/python/App/Hotfixes.py
  U   Zope/trunk/lib/python/App/ProductContext.py
  U   Zope/trunk/lib/python/App/RefreshFuncs.py
  U   Zope/trunk/lib/python/App/special_dtml.py

-=-
Modified: Zope/trunk/lib/python/App/ApplicationManager.py
===================================================================
--- Zope/trunk/lib/python/App/ApplicationManager.py	2006-01-08 10:39:07 UTC (rev 41196)
+++ Zope/trunk/lib/python/App/ApplicationManager.py	2006-01-08 10:47:25 UTC (rev 41197)
@@ -15,6 +15,7 @@
 __version__='$Revision: 1.94 $'[11:-2]
 
 import sys,os,time,Globals, Acquisition, os, Undo
+from logging import getLogger
 from Globals import InitializeClass
 from Globals import DTMLFile
 from OFS.ObjectManager import ObjectManager
@@ -32,9 +33,10 @@
 from zExceptions import Redirect
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from cgi import escape
-import zLOG
 import Lifetime
 
+LOG = getLogger('ApplicationManager')
+
 try: import thread
 except: get_ident=lambda: 0
 else: get_ident=thread.get_ident
@@ -392,8 +394,7 @@
                 user = '"%s"' % getSecurityManager().getUser().getUserName()
             except:
                 user = 'unknown user'
-            zLOG.LOG("ApplicationManager", zLOG.INFO,
-                     "Restart requested by %s" % user)
+            LOG.info("Restart requested by %s" % user)
             #for db in Globals.opened: db.close()
             Lifetime.shutdown(1)
             return """<html>
@@ -408,8 +409,7 @@
             user = '"%s"' % getSecurityManager().getUser().getUserName()
         except:
             user = 'unknown user'
-        zLOG.LOG("ApplicationManager", zLOG.INFO,
-                 "Shutdown requested by %s" % user)
+        LOG.info("Shutdown requested by %s" % user)
         #for db in Globals.opened: db.close()
         Lifetime.shutdown(0)
         return """<html>

Modified: Zope/trunk/lib/python/App/Hotfixes.py
===================================================================
--- Zope/trunk/lib/python/App/Hotfixes.py	2006-01-08 10:39:07 UTC (rev 41196)
+++ Zope/trunk/lib/python/App/Hotfixes.py	2006-01-08 10:47:25 UTC (rev 41197)
@@ -12,8 +12,11 @@
 ##############################################################################
 
 from version_txt import getZopeVersion
-from zLOG import LOG, INFO, WARNING
+from logging import getLogger
 
+
+LOG = getLogger('Hotfixes')
+
 merged_hotfixes = {
     'Hotfix_2001-09-28': 1,
     'Hotfix_2002-03-01': 1,
@@ -33,13 +36,13 @@
 
 def logHotfix(id, apply_hotfix):
     if apply_hotfix:
-        LOG('Hotfixes', INFO, 'Applying %s' % id)
+        LOG.info('Applying %s' % id)
     elif apply_hotfix is OUTDATED_ZOPE:
-        LOG('Hotfixes', WARNING, 'Not applying %s.  It is not designed for '
+        LOG.warn('Not applying %s.  It is not designed for '
             'this version of Zope.  Please uninstall the hotfix product.'
             % id)
     else:  # ALREADY_MERGED
-        LOG('Hotfixes', WARNING, 'Not applying %s.  The fix has already been '
+        LOG.warn('Not applying %s.  The fix has already been '
             'merged into Zope.  Please uninstall the hotfix product.'
             % id)
 

Modified: Zope/trunk/lib/python/App/ProductContext.py
===================================================================
--- Zope/trunk/lib/python/App/ProductContext.py	2006-01-08 10:39:07 UTC (rev 41196)
+++ Zope/trunk/lib/python/App/ProductContext.py	2006-01-08 10:47:25 UTC (rev 41197)
@@ -15,8 +15,9 @@
 $Id$
 """
 
+import stat
 import os.path, re
-import stat
+from logging import getLogger
 
 from AccessControl.PermissionRole import PermissionRole
 import Globals, os, OFS.ObjectManager, OFS.misc_, Products
@@ -25,7 +26,7 @@
 from HelpSys import HelpTopic, APIHelpTopic
 from HelpSys.HelpSys import ProductHelp
 from FactoryDispatcher import FactoryDispatcher
-from zLOG import LOG, WARNING
+
 from DateTime import DateTime
 from Interface.Implements import instancesOfObjectImplements
 from zope.interface import implementedBy
@@ -39,8 +40,8 @@
     Products.meta_class_info={}
 
 _marker = []  # Create a new marker object
+LOG = getLogger('ProductContext')
 
-
 class ProductContext:
 
     def __init__(self, product, app, package):
@@ -312,7 +313,7 @@
         try:
             dir_mod_time=DateTime(os.stat(path)[stat.ST_MTIME])
         except OSError, (errno, text):
-            LOG("Zope", WARNING, '%s: %s' % (text, path))
+            LOG.warn('%s: %s' % (text, path))
             return
 
         # test to see if nothing has changed since last registration

Modified: Zope/trunk/lib/python/App/RefreshFuncs.py
===================================================================
--- Zope/trunk/lib/python/App/RefreshFuncs.py	2006-01-08 10:39:07 UTC (rev 41196)
+++ Zope/trunk/lib/python/App/RefreshFuncs.py	2006-01-08 10:47:25 UTC (rev 41197)
@@ -17,12 +17,14 @@
 
 import os, sys
 from time import time
+from traceback import format_exception
+from logging import getLogger
 import transaction
 import Products
 from ExtensionClass import Base
 from Globals import PersistentMapping
-from zLOG import format_exception, LOG, ERROR, INFO
 
+LOG = getLogger('RefreshFuncs')
 global_classes_timestamp = 0
 products_mod_times = {}
 
@@ -136,8 +138,7 @@
 def logBadRefresh(productid):
     exc = sys.exc_info()
     try:
-        LOG('Refresh', ERROR, 'Exception while refreshing %s'
-            % productid, error=exc)
+        LOG.error('Exception while refreshing %s' % productid, exc_info=exc)
         if hasattr(exc[0], '__name__'):
             error_type = exc[0].__name__
         else:
@@ -179,7 +180,7 @@
 
 def performSafeRefresh(jar, productid):
     try:
-        LOG('Refresh', INFO, 'Refreshing product %s' % productid)
+        LOG.info('Refreshing product %s' % productid)
         if not performRefresh(jar, productid):
             return 0
     except:

Modified: Zope/trunk/lib/python/App/special_dtml.py
===================================================================
--- Zope/trunk/lib/python/App/special_dtml.py	2006-01-08 10:39:07 UTC (rev 41196)
+++ Zope/trunk/lib/python/App/special_dtml.py	2006-01-08 10:47:25 UTC (rev 41197)
@@ -13,9 +13,12 @@
 
 import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys
 from types import InstanceType
-from zLOG import LOG,WARNING
+from logging import getLogger
 from App.config import getConfiguration
 
+
+LOG = getLogger('special_dtml')
+
 class HTML(DocumentTemplate.HTML,Persistence.Persistent,):
     "Persistent HTML Document Templates"
 
@@ -176,7 +179,7 @@
                 except DTReturn, v: result = v.v
                 except AttributeError:
                     if type(sys.exc_value)==InstanceType and sys.exc_value.args[0]=="_v_blocks":
-                        LOG("ZPublisher",WARNING,"DTML file '%s' could not be read" % self.raw)
+                        LOG.warn("DTML file '%s' could not be read" % self.raw)
                         raise ValueError, ("DTML file error: "
                                            "Check logfile for details")
                     else:



More information about the Zope-Checkins mailing list