Commit c6713a93 authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 077213b0
......@@ -15,6 +15,7 @@ __doc__="""System management components"""
__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 AccessControl import getSecurityManager
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 @@ class ApplicationManager(Folder,CacheManager):
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 @@ class ApplicationManager(Folder,CacheManager):
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>
......
......@@ -12,7 +12,10 @@
##############################################################################
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,
......@@ -33,13 +36,13 @@ def isMerged(name):
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)
......
......@@ -15,8 +15,9 @@
$Id$
"""
import os.path, re
import stat
import os.path, re
from logging import getLogger
from AccessControl.PermissionRole import PermissionRole
import Globals, os, OFS.ObjectManager, OFS.misc_, Products
......@@ -25,7 +26,7 @@ from App.Product import doInstall
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,7 +40,7 @@ if not hasattr(Products, 'meta_classes'):
Products.meta_class_info={}
_marker = [] # Create a new marker object
LOG = getLogger('ProductContext')
class ProductContext:
......@@ -312,7 +313,7 @@ class ProductContext:
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
......
......@@ -17,12 +17,14 @@ $Id$
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 listRefreshableModules(productid):
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 performRefresh(jar, productid):
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:
......
......@@ -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 @@ class DTMLFile(Bindings, Explicit, ClassicHTMLFile):
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:
......
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