Changeset 5564


Ignore:
Timestamp:
8 Oct 2010, 10:29:09 (14 years ago)
Author:
Henrik Bettermann
Message:

Search log files online.

Location:
WAeUP_SRP/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r5518 r5564  
    197197    def openLog(self,name):
    198198        """open a log file"""
    199         version = 1
    200         path = "%s/log/%s_%d.log" % (i_home,name,version)
    201         while os.path.exists(path):
    202             version += 1
    203             path = "%s/log/%s_%d.log" % (i_home,name,version)
    204         log = open(path,"w")
    205         return log
    206     ###)
     199        path = "%s/log/%s" % (i_home,name)
     200        #import pdb;pdb.set_trace()
     201        if os.path.exists(path):
     202            log = open(path,"rb")
     203            lines = log.readlines()
     204            return lines
     205        else:
     206            return None
     207    ###)
     208   
     209    security.declareProtected(ModifyPortalContent,'grepLog') ###(
     210    def grepLog(self,name,searchstring):
     211        """open a log file"""
     212        path = "%s/log/%s" % (i_home,name)
     213        #import pdb;pdb.set_trace()
     214        if os.path.exists(path):
     215            popen = os.popen('grep %s %s' % (searchstring,path))
     216            lines = popen.readlines()
     217            popen.close()
     218            return lines
     219        else:
     220            return None
     221    ###)   
    207222
    208223    security.declareProtected(ModifyPortalContent,'bypassQueueCatalog') ###(
Note: See TracChangeset for help on using the changeset viewer.