Commit c6713a93 authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 077213b0
...@@ -15,6 +15,7 @@ __doc__="""System management components""" ...@@ -15,6 +15,7 @@ __doc__="""System management components"""
__version__='$Revision: 1.94 $'[11:-2] __version__='$Revision: 1.94 $'[11:-2]
import sys,os,time,Globals, Acquisition, os, Undo import sys,os,time,Globals, Acquisition, os, Undo
from logging import getLogger
from Globals import InitializeClass from Globals import InitializeClass
from Globals import DTMLFile from Globals import DTMLFile
from OFS.ObjectManager import ObjectManager from OFS.ObjectManager import ObjectManager
...@@ -32,9 +33,10 @@ from AccessControl import getSecurityManager ...@@ -32,9 +33,10 @@ from AccessControl import getSecurityManager
from zExceptions import Redirect from zExceptions import Redirect
from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from cgi import escape from cgi import escape
import zLOG
import Lifetime import Lifetime
LOG = getLogger('ApplicationManager')
try: import thread try: import thread
except: get_ident=lambda: 0 except: get_ident=lambda: 0
else: get_ident=thread.get_ident else: get_ident=thread.get_ident
...@@ -392,8 +394,7 @@ class ApplicationManager(Folder,CacheManager): ...@@ -392,8 +394,7 @@ class ApplicationManager(Folder,CacheManager):
user = '"%s"' % getSecurityManager().getUser().getUserName() user = '"%s"' % getSecurityManager().getUser().getUserName()
except: except:
user = 'unknown user' user = 'unknown user'
zLOG.LOG("ApplicationManager", zLOG.INFO, LOG.info("Restart requested by %s" % user)
"Restart requested by %s" % user)
#for db in Globals.opened: db.close() #for db in Globals.opened: db.close()
Lifetime.shutdown(1) Lifetime.shutdown(1)
return """<html> return """<html>
...@@ -408,8 +409,7 @@ class ApplicationManager(Folder,CacheManager): ...@@ -408,8 +409,7 @@ class ApplicationManager(Folder,CacheManager):
user = '"%s"' % getSecurityManager().getUser().getUserName() user = '"%s"' % getSecurityManager().getUser().getUserName()
except: except:
user = 'unknown user' user = 'unknown user'
zLOG.LOG("ApplicationManager", zLOG.INFO, LOG.info("Shutdown requested by %s" % user)
"Shutdown requested by %s" % user)
#for db in Globals.opened: db.close() #for db in Globals.opened: db.close()
Lifetime.shutdown(0) Lifetime.shutdown(0)
return """<html> return """<html>
......
...@@ -12,7 +12,10 @@ ...@@ -12,7 +12,10 @@
############################################################################## ##############################################################################
from version_txt import getZopeVersion from version_txt import getZopeVersion
from zLOG import LOG, INFO, WARNING from logging import getLogger
LOG = getLogger('Hotfixes')
merged_hotfixes = { merged_hotfixes = {
'Hotfix_2001-09-28': 1, 'Hotfix_2001-09-28': 1,
...@@ -33,13 +36,13 @@ def isMerged(name): ...@@ -33,13 +36,13 @@ def isMerged(name):
def logHotfix(id, apply_hotfix): def logHotfix(id, apply_hotfix):
if apply_hotfix: if apply_hotfix:
LOG('Hotfixes', INFO, 'Applying %s' % id) LOG.info('Applying %s' % id)
elif apply_hotfix is OUTDATED_ZOPE: 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.' 'this version of Zope. Please uninstall the hotfix product.'
% id) % id)
else: # ALREADY_MERGED 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.' 'merged into Zope. Please uninstall the hotfix product.'
% id) % id)
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
$Id$ $Id$
""" """
import os.path, re
import stat import stat
import os.path, re
from logging import getLogger
from AccessControl.PermissionRole import PermissionRole from AccessControl.PermissionRole import PermissionRole
import Globals, os, OFS.ObjectManager, OFS.misc_, Products import Globals, os, OFS.ObjectManager, OFS.misc_, Products
...@@ -25,7 +26,7 @@ from App.Product import doInstall ...@@ -25,7 +26,7 @@ from App.Product import doInstall
from HelpSys import HelpTopic, APIHelpTopic from HelpSys import HelpTopic, APIHelpTopic
from HelpSys.HelpSys import ProductHelp from HelpSys.HelpSys import ProductHelp
from FactoryDispatcher import FactoryDispatcher from FactoryDispatcher import FactoryDispatcher
from zLOG import LOG, WARNING
from DateTime import DateTime from DateTime import DateTime
from Interface.Implements import instancesOfObjectImplements from Interface.Implements import instancesOfObjectImplements
from zope.interface import implementedBy from zope.interface import implementedBy
...@@ -39,7 +40,7 @@ if not hasattr(Products, 'meta_classes'): ...@@ -39,7 +40,7 @@ if not hasattr(Products, 'meta_classes'):
Products.meta_class_info={} Products.meta_class_info={}
_marker = [] # Create a new marker object _marker = [] # Create a new marker object
LOG = getLogger('ProductContext')
class ProductContext: class ProductContext:
...@@ -312,7 +313,7 @@ class ProductContext: ...@@ -312,7 +313,7 @@ class ProductContext:
try: try:
dir_mod_time=DateTime(os.stat(path)[stat.ST_MTIME]) dir_mod_time=DateTime(os.stat(path)[stat.ST_MTIME])
except OSError, (errno, text): except OSError, (errno, text):
LOG("Zope", WARNING, '%s: %s' % (text, path)) LOG.warn('%s: %s' % (text, path))
return return
# test to see if nothing has changed since last registration # test to see if nothing has changed since last registration
......
...@@ -17,12 +17,14 @@ $Id$ ...@@ -17,12 +17,14 @@ $Id$
import os, sys import os, sys
from time import time from time import time
from traceback import format_exception
from logging import getLogger
import transaction import transaction
import Products import Products
from ExtensionClass import Base from ExtensionClass import Base
from Globals import PersistentMapping from Globals import PersistentMapping
from zLOG import format_exception, LOG, ERROR, INFO
LOG = getLogger('RefreshFuncs')
global_classes_timestamp = 0 global_classes_timestamp = 0
products_mod_times = {} products_mod_times = {}
...@@ -136,8 +138,7 @@ def listRefreshableModules(productid): ...@@ -136,8 +138,7 @@ def listRefreshableModules(productid):
def logBadRefresh(productid): def logBadRefresh(productid):
exc = sys.exc_info() exc = sys.exc_info()
try: try:
LOG('Refresh', ERROR, 'Exception while refreshing %s' LOG.error('Exception while refreshing %s' % productid, exc_info=exc)
% productid, error=exc)
if hasattr(exc[0], '__name__'): if hasattr(exc[0], '__name__'):
error_type = exc[0].__name__ error_type = exc[0].__name__
else: else:
...@@ -179,7 +180,7 @@ def performRefresh(jar, productid): ...@@ -179,7 +180,7 @@ def performRefresh(jar, productid):
def performSafeRefresh(jar, productid): def performSafeRefresh(jar, productid):
try: try:
LOG('Refresh', INFO, 'Refreshing product %s' % productid) LOG.info('Refreshing product %s' % productid)
if not performRefresh(jar, productid): if not performRefresh(jar, productid):
return 0 return 0
except: except:
......
...@@ -13,9 +13,12 @@ ...@@ -13,9 +13,12 @@
import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys
from types import InstanceType from types import InstanceType
from zLOG import LOG,WARNING from logging import getLogger
from App.config import getConfiguration from App.config import getConfiguration
LOG = getLogger('special_dtml')
class HTML(DocumentTemplate.HTML,Persistence.Persistent,): class HTML(DocumentTemplate.HTML,Persistence.Persistent,):
"Persistent HTML Document Templates" "Persistent HTML Document Templates"
...@@ -176,7 +179,7 @@ class DTMLFile(Bindings, Explicit, ClassicHTMLFile): ...@@ -176,7 +179,7 @@ class DTMLFile(Bindings, Explicit, ClassicHTMLFile):
except DTReturn, v: result = v.v except DTReturn, v: result = v.v
except AttributeError: except AttributeError:
if type(sys.exc_value)==InstanceType and sys.exc_value.args[0]=="_v_blocks": 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: " raise ValueError, ("DTML file error: "
"Check logfile for details") "Check logfile for details")
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment