Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Initial Version and Version 1 of LoggingConfiguration


Ignore:
Timestamp:
05/10/06 02:15:46 (13 years ago)
Author:
max
Comment:

initial version

Legend:

Unmodified
Added
Removed
Modified
  • LoggingConfiguration

    v1 v1  
     1Starting from release 0.9a5, TurboGears supports configuring logging directly via project's configuration files.  
     2 
     3Configuration format is mostly opaque to TurboGears - data is justed passed down to [http://docs.python.org/lib/module-logging.html logging module]. Since configuring logging is sometimes tricky (especially for novices) here are a few recipes. 
     4 
     5== Sample !#1 == 
     6 
     7Say you have a project named Foobar which logs under "foobar.*" namespace. You want to: 
     8 
     9  * separate log for all project messages, including DEBUG messages 
     10  * separate log for all errors messages (including, but not limited to your project) 
     11  * separate log for all non-debug messages (including, but not limited to your project) 
     12 
     13Put the following into your prod.cfg: 
     14 
     15{{{ 
     16[logging] 
     17 
     18[[handlers]] 
     19[[[debug_out]]] 
     20class='FileHandler' 
     21formatter='full_content' 
     22args="('foobar-debug.log', 'a+')" 
     23 
     24[[[error_out]]] 
     25level='WARN' 
     26class='FileHandler' 
     27formatter='full_content' 
     28args="('foobar-errors.log', 'a+')" 
     29 
     30[[[access_out]]] 
     31level='INFO' 
     32class='FileHandler' 
     33formatter='full_content' 
     34args="('foobar-info.log', 'a+')" 
     35 
     36[[loggers]] 
     37[[[your_project]]] 
     38level='DEBUG' 
     39qualname='foobar' 
     40handlers=['debug_out'] 
     41 
     42[[[access]]] 
     43level='INFO' 
     44handlers=['access_out', 'error_out'] 
     45}}} 
     46 
     47You may want to tweak filenames to be absolute.