The ``exception`` method on the logger does this. It pulls the last exception from ``sys.exc_info()``. For example:

```
2013-10-07 16:42:20,439 INFO  [cnxarchive][Dummy-1] GET - /search?q=music
2013-10-07 16:42:20,462 ERROR [cnxarchive][Dummy-1] Unknown exception
Traceback (most recent call last):
  File "/Users/pumazi/looney-env/cnx-archive/cnxarchive/__init__.py", line 94, in __call__
    return controller(environ, start_response)
  File "/Users/pumazi/looney-env/cnx-archive/cnxarchive/views.py", line 228, in search
    db_results = database_search(query)
  File "/Users/pumazi/looney-env/cnx-archive/cnxarchive/search.py", line 389, in search
    cursor.execute(statement, arguments)
ProgrammingError: relation "users" does not exist
LINE 161:   users u
            ^
```