Version 14 (modified by izzy, 9 years ago) (diff)


View the trac.log file via the web frontend


This plugin allows you to view your trac.log logfile without shell access, just via the Web-UI Admin interface. You can select to only display messages from a specified log level (e.g. only warnings), optionally including higher levels. So if you select "Debug" and all higher levels, this means to display the entire log. Moreover, you may restrict the output to the latest N lines, and even filter for lines containing a specified string or even matching a regular expression.

Be careful with large log files ;)

Bugs/Feature Requests

Existing bugs and feature requests for LogViewerPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:logviewerplugin here] (development version). You can also download the Python Egg of the latest release from this page.


You can check out LogViewerPlugin from here using Subversion, or browse the source with Trac.


The easiest way to install this plugin is:


You can also checkout the code from the repository, or download and unpack the zipped source (see above) - and then run either easy_install or python from where the file resides.

Moreover, you will need to enable the plugin for your trac environment(s):

logviewer.* = enabled

There's no more configuration required.


No - no kidding. I said there's no more configuration required - however, it is possible. If you want the LogViewerPlugin to immediately load and show content from your log file without the need to first (fill some form and) push the button, you can do so. With the IniAdminPlugin installed, just call up the logviewer section, and it will explain you the details. For everybody else, the details are here:

You need to introduce a new section to your trac.ini file. Using the default settings, it would look like this:

autoload = false
autotail = 1000
autolevel = 3
autoup = true

So what do those settings mean? Quite clear: autoload decides whether you want to turn this feature on (true) or not. By default, it is turned off. All the other auto* settings only apply if you set autoload = true.

With the autotail setting you limit LogViewerPlugin to those many lines from the end of the file. Normally, 1000 lines will be enough - but if you want to show everything, simply set it to an empty value (as shown below for defaultlevel). Keep in mind that with a huge log file, the page will take some time to load - every time you call up LogViewerPlugin. So better keep this value to something reasonable, and do the unusual full display on demand only.

autolevel specifies the log level to display, and autoup decides whether higher priority levels (i.e. those with lower numbers) shall be included. Note that this is a numeric value (integer, to be more precise) - and reaches from 1=critical to 5=debug (including 2=error, and 4=info), with a default of 3=warning.

If you are not happy with the default presets of the form fields - you can change them for some of the fields:

defaultlevel = 3
defaultup = true
defaulttail =

The meaning of those three settings corresponds to the similarly named items from the autoload - with the difference that the values here only apply when autoload is disabled.


You find the Log Viewer on the Admin page in the General section (see below). Having this page called, you select the log level you wish to see the entries for, using the drop-down. Optionally, you may chose to display all "higher priority" as well (where "higher" means the entries on top of the one you selected).

Optionally, you now can further restrict the amount of lines displayed: The Tail input works similar to the tail -f command, only showing the last N lines. If you input nothing here, this restriction is skipped - but if you do, the following search will be limited to these lines. In the Search input box you can enter a term which must be found in a line to be displayed. You can also use regular expressions here, in which case you must check the corresponding button. If you additionally check the "not" button, that search will be inverted - i.e. only lines not containing/matching your search term will be shown.

Oh, btw: hovering your mouse over the input areas will give you a short tooltip, in case you forgot these meanings ;)

Once you made your selections, push the button - and the matching lines from the trac.log will be displayed.


Hell, what example? OK: Here is what it may look like, having selected "Warnings and above":

Viewing selected log entries

As you can see, the log lines are quite colorful: each log level has its distinct color assigned. If you don't like my choice of colors here, you can easily apply your own style sheets. All elements can be identified without problems: the different log levels use classes, and even the other elements of the GUI use classes and ids.

User Comments

  • Your feedback here, please :-) Or if you don't want to write something yourself, use the poll below (you must be logged in to vote):

Let others know what you think about the LogViewerPlugin:
  • I use it and I like it! (rjollos, olemis)
  • I use it and find it acceptable. (ntmlod)
  • I tried it and didn't like it
  • I think it's great stuff and will give it a try! (otaku42)
  • I don't know what to think about it.

  • You don't have permission to vote. You may need to login.

Recent Changes

16537 by rjollos on 2017-04-16 02:32:02
Fix indentation
13412 by izzy on 2013-10-11 21:33:52
! fixing unicode issue as reported with ticket:7527
13411 by izzy on 2013-10-11 21:20:20
separating code working before the localizing in Trac 0.11 to its own branch before adding changes not tested on earlier versions


Author: izzy

Attachments (3)

Download all attachments as: .zip