Last change
on this file since 17977 was
5564,
checked in by Henrik Bettermann, 14 years ago
|
Search log files online.
|
-
Property svn:keywords set to
Id
|
File size:
981 bytes
|
Line | |
---|
1 | ## Script (Python) "grepLog" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=searchstring='', filename='event.log' |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | """ |
---|
11 | return logfile entries |
---|
12 | """ |
---|
13 | |
---|
14 | import logging |
---|
15 | logger = logging.getLogger('Skins.grepLog') |
---|
16 | mtool = context.portal_membership |
---|
17 | member = mtool.getAuthenticatedMember() |
---|
18 | |
---|
19 | wtool = context.waeup_tool |
---|
20 | |
---|
21 | request = context.REQUEST |
---|
22 | response = request.RESPONSE |
---|
23 | |
---|
24 | def rwrite(s): |
---|
25 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
26 | response.write(s) |
---|
27 | |
---|
28 | |
---|
29 | loglines = wtool.grepLog(filename,searchstring) |
---|
30 | |
---|
31 | if not loglines: |
---|
32 | return |
---|
33 | |
---|
34 | logger.info('%s searched %s' % (member,filename)) |
---|
35 | |
---|
36 | #from Products.zdb import set_trace |
---|
37 | #set_trace() |
---|
38 | |
---|
39 | rwrite("--------- grep '%s' %s ----------<br />\r\n" % (searchstring,filename)) |
---|
40 | for line in loglines: |
---|
41 | if not 'ConflictError' in line: |
---|
42 | rwrite("%s<br />\r\n" %line) |
---|
43 | rwrite("--------- end ----------<br />\r\n") |
---|
Note: See
TracBrowser for help on using the repository browser.