Ticket #5148 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

[Patch] Traceback from logging module when log is empty

Reported by: ebray Assigned to: osimons
Priority: normal Component: TracDeveloperPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Immediately after enabling the developer plugin in a particular environment I started getting an IndexError with this traceback on every page:

File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 438, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 230, in dispatch
  data, content_type)
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 745, in render_template
  stream.render(method, doctype=doctype, out=buffer)
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 179, in render
  return encode(generator, method=method, encoding=encoding, out=out)
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 61, in encode
  for chunk in iterator:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 311, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 753, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 592, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 698, in __call__
  for kind, data, pos in chain(stream, [(None, None, None)]):
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 532, in __call__
  for ev in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 811, in _strip_accesskeys
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 800, in _generate
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/mnt/hgfs/home/Source/tracdeveloperplugin/trunk/tracdeveloper/log.py", line 64, in fn
  first_time = req._tracdeveloper_hdlr.buf[0].created

Eventually I realized that it was because nothing was coming up in the log during that request (as the log level was set to WARNING). Clearly this feature was meant to be used with the log level set to DEBUG, which would make sense for development purposes. But this bit me by trying to use the plugin in an environment where DEBUG would not be the default.

Perhaps the log module should itself log a warning if the log level is set above DEBUG.

Attachments

5148.empty_log.diff (0.6 kB) - added by techtonik on 12/25/09 21:00:34.
patch to fix this issue - add check for empty buffer

Change History

12/25/09 21:00:34 changed by techtonik

  • attachment 5148.empty_log.diff added.

patch to fix this issue - add check for empty buffer

01/29/10 00:47:04 changed by rjollos

  • summary changed from Traceback from logging module when log is empty to [Patch] Traceback from logging module when log is empty.

I have also been seeing this issue. Thank you for the patch and explanation of the cause of the issue.

01/29/10 07:17:27 changed by rjollos

Specifically, I think this was the cause of #6483.

02/22/10 06:21:46 changed by rjollos

  • owner changed from athomas to coderanger.

Question to plugin maintainer: do you have any objections to applying this patch? If it is just a matter of not having time to do it, I would be happy to take care of the issue given write access to the repository.

Thanks.

05/21/10 00:18:56 changed by osimons

  • owner changed from coderanger to osimons.

Makes sense. I'll look at it and commit.

05/21/10 01:59:43 changed by osimons

  • status changed from new to closed.
  • resolution set to fixed.

(In [7968]) TracDeveloperPlugin: Gracefully handle empty log. Closes #5148. Thanks for report and patch.


Add/Change #5148 ([Patch] Traceback from logging module when log is empty)




Change Properties
Action