<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TracLogging</id>
	<title>TracLogging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TracLogging"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TracLogging&amp;action=history"/>
	<updated>2026-04-20T23:42:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=TracLogging&amp;diff=309&amp;oldid=prev</id>
		<title>Maintenance script: Created page with &quot; == Trac Logging == TracGuideToc  Trac supports logging of system messages using the standard [http://docs.python.org/lib/module-logging.html logging module] that comes wi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TracLogging&amp;diff=309&amp;oldid=prev"/>
		<updated>2015-08-26T12:29:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; == Trac Logging == &lt;a href=&quot;/index.php?title=TracGuideToc&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;TracGuideToc (page does not exist)&quot;&gt;TracGuideToc&lt;/a&gt;  Trac supports logging of system messages using the standard [http://docs.python.org/lib/module-logging.html logging module] that comes wi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Trac Logging ==&lt;br /&gt;
[[TracGuideToc]]&lt;br /&gt;
&lt;br /&gt;
Trac supports logging of system messages using the standard [http://docs.python.org/lib/module-logging.html logging module] that comes with Python.&lt;br /&gt;
&lt;br /&gt;
Logging is configured in the &amp;lt;tt&amp;gt;[logging]&amp;lt;/tt&amp;gt; section in [[TracIni#logging-section| trac.ini]].&lt;br /&gt;
&lt;br /&gt;
=== Supported Logging Methods ===&lt;br /&gt;
&lt;br /&gt;
The log method is set using the &amp;lt;tt&amp;gt;log_type&amp;lt;/tt&amp;gt; option in [[TracIni#logging-section| trac.ini]], which takes any of the following values:&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;none&amp;#039;&amp;#039;:: Suppress all log messages.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;file&amp;#039;&amp;#039;&amp;#039;:: Log messages to a file, specified with the &amp;lt;tt&amp;gt;log_file&amp;lt;/tt&amp;gt; option in [[TracIni#logging-section| trac.ini]]. &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;stderr&amp;#039;&amp;#039;&amp;#039;:: Output all log entries to console ([[TracStandalone| tracd]] only).&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;syslog&amp;#039;&amp;#039;&amp;#039;:: (UNIX) Send all log messages to the local syslogd via named pipe &amp;lt;tt&amp;gt;/dev/log&amp;lt;/tt&amp;gt;. By default, syslog will write them to the file /var/log/messages.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;eventlog&amp;#039;&amp;#039;&amp;#039;:: (Windows) Use the system&amp;#039;s NT Event Log for Trac logging.&lt;br /&gt;
&lt;br /&gt;
=== Log Levels ===&lt;br /&gt;
&lt;br /&gt;
The verbosity level of logged messages can be set using the &amp;lt;tt&amp;gt;log_level&amp;lt;/tt&amp;gt; option in [[TracIni#logging-section| trac.ini]]. The log level defines the minimum level of urgency required for a message to be logged, and those levels are:&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;CRITICAL&amp;#039;&amp;#039;&amp;#039;:: Log only the most critical (typically fatal) errors.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;ERROR&amp;#039;&amp;#039;&amp;#039;:: Log failures, bugs and errors. &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;WARN&amp;#039;&amp;#039;&amp;#039;:: Log warnings, non-interrupting events.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;INFO&amp;#039;&amp;#039;&amp;#039;:: Diagnostic information, log information about all processing.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;DEBUG&amp;#039;&amp;#039;&amp;#039;:: Trace messages, profiling, etc.&lt;br /&gt;
&lt;br /&gt;
Note that starting with Trac 0.11.5 you can in addition enable logging of SQL statements, at debug level. This is turned off by default, as it&amp;#039;s very verbose (set &amp;lt;tt&amp;gt;[trac] debug_sql = yes&amp;lt;/tt&amp;gt; in TracIni to activate).&lt;br /&gt;
&lt;br /&gt;
=== Log Format ===&lt;br /&gt;
&lt;br /&gt;
Starting with Trac 0.10.4 (see [trac:#2844 #2844]), it is possible to set the output format for log entries. This can be done through the &amp;lt;tt&amp;gt;log_format&amp;lt;/tt&amp;gt; option in [[TracIni#logging-section| trac.ini]]. The format is a string which can contain any of the [http://docs.python.org/lib/node422.html Python logging Formatter variables]. Additonally, the following Trac-specific variables can be used:&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;$(basename)s&amp;#039;&amp;#039;&amp;#039;:: The last path component of the current environment.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;$(path)s&amp;#039;&amp;#039;&amp;#039;:: The absolute path for the current environment.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;$(project)s&amp;#039;&amp;#039;&amp;#039;:: The originating project&amp;#039;s name.&lt;br /&gt;
&lt;br /&gt;
Note that variables are identified using a dollar sign (&amp;lt;tt&amp;gt;$(...)s&amp;lt;/tt&amp;gt;) instead of percent sign (&amp;lt;tt&amp;gt;%(...)s&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The default format is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
log_format = Trac[$(module)s] $(levelname)s: $(message)s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a multi-project environment where all logs are sent to the same place (e.g. &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;), it makes sense to add the project name. In this example we use &amp;lt;tt&amp;gt;basename&amp;lt;/tt&amp;gt; since that can generally be used to identify a project:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
log_format = Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
See also: TracIni, TracGuide, TracEnvironment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TracNotice|{{PAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>