Ignore:
Timestamp:
2 Mar 2012, 10:32:47 (13 years ago)
Author:
Henrik Bettermann
Message:

I suggest to use the Unix 'grep' command for searching log files. Indeed, this only works on our preferred OS but who cares?

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/batchprocessing.txt

    r7705 r7749  
    142142    ...File:...faculties_zope.mgr.csv...
    143143
    144 We can watch the entries generated in logfile:
     144We can grep the entries generated in logfile:
    145145
    146146    >>> browser.getControl('View processing log').click()
    147147    >>> print browser.contents
    148148    <!DOCTYPE ...
    149     <pre>...
    150  
    151     ... - INFO - --------------------
    152     ... - INFO - zope.mgr: Batch processing finished: OK
    153     ... - INFO - zope.mgr: Source: /.../faculties_zope.mgr.csv
    154     ... - INFO - zope.mgr: Mode: create
    155     ... - INFO - zope.mgr: User: zope.mgr
    156     ... - INFO - zope.mgr: Processing time: ... s (... s/item)
    157     ... - INFO - zope.mgr: Processed: 3 lines (3 successful/ 0 failed)
    158     ... - INFO - --------------------
    159     </pre>
    160     ....
     149    ...<h1>Logfile datacenter.log</h1>...
     150
     151    >>> browser.getControl(name='query').value = "zope.mgr"
     152    >>> browser.getControl('Search').click()
     153    >>> 'zope.mgr: Batch processing finished: OK' in browser.contents
     154    True
     155    >>> 'Mode: create' in browser.contents
     156    True
     157
     158    >>> browser.getControl(name='query').value = "finished"
     159    >>> browser.getControl('Search').click()
     160    >>> 'zope.mgr: Batch processing finished: OK' in browser.contents
     161    True
     162    >>> 'Mode: create' in browser.contents
     163    False
    161164
    162165
     
    564567    True
    565568    >>> browser.getControl('Show', index=0).click()
    566     >>> '<input class="btn primary" type="submit" name="back" value="Back" />' in browser.contents
    567     True
    568569    >>> browser.getControl('Back', index=0).click()
    569570    >>> browser.getControl('Back to Data Center').click()
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7741 r7749  
    11401140    title = _(u'Data Center')
    11411141    pnav = 0
     1142    search_button = _('Search')
     1143    back_button = _('Back')
    11421144
    11431145    def label(self):
    11441146        return "Logfile %s" % self.filename
    11451147
    1146     def update(self, show=None, remove=None, back=None):
     1148    def update(self, back=None, query=None):
    11471149        session = ISession(self.request)['waeup.sirp']
    11481150        logname = session.get('logname', None)
     
    11511153            return
    11521154        self.filename = logname
     1155        form = self.request.form
     1156        self.query = ''
     1157        query = form.get('query')
     1158        if search is None or not query:
     1159            return
    11531160        self.files = self.context.getLogFiles()
    11541161        fullpath = os.path.join(self.context.storage, 'logs', logname)
    1155         self.filecontents = open(fullpath, 'rb').read()
     1162
     1163        self.query = query
     1164        #self.filecontents = open(fullpath, 'rb').read()
     1165        popen = os.popen('grep %s %s' % (query,fullpath))
     1166        self.grepresult = popen.read()
     1167        popen.close()
    11561168
    11571169class DatacenterSettings(SIRPPage):
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/datacenterlogsshowfilepage.pt

    r7465 r7749  
    1 <form method="POST">
    2   <input class="btn primary" type="submit" name="back" value="Back" />
     1<form method="post">
     2  <input type="text" name="query"
     3         tal:attributes="value view/query" />
     4    <input class="btn primary" type="submit" name="search"
     5      tal:attributes="value view/search_button"/>
     6    <input class="btn" type="submit" name="back"
     7      tal:attributes="value view/back_button"/>
    38</form>
    49
    5 <div>
    6   <pre tal:content="view/filecontents">
    7     blah, blah
     10<div tal:condition="view/grepresult|nothing">
     11  <pre tal:content="structure view/grepresult">
     12    GREPRESULT
    813  </pre>
    914</div>
    10 
    11 <form method="POST">
    12   <input class="btn primary" type="submit" name="back" value="Back" />
    13 </form>
Note: See TracChangeset for help on using the changeset viewer.