<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=LogsConfig</id>
	<title>LogsConfig - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=LogsConfig"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=LogsConfig&amp;action=history"/>
	<updated>2026-08-22T14:09:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=LogsConfig&amp;diff=1876&amp;oldid=prev</id>
		<title>Admin: 9 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=LogsConfig&amp;diff=1876&amp;oldid=prev"/>
		<updated>2016-04-06T20:14:19Z</updated>

		<summary type="html">&lt;p&gt;9 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:14, 6 April 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-1875:rev-1876 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=LogsConfig&amp;diff=1875&amp;oldid=prev</id>
		<title>128.82.44.7: Corrected some grammatical errors.</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=LogsConfig&amp;diff=1875&amp;oldid=prev"/>
		<updated>2014-02-24T18:53:36Z</updated>

		<summary type="html">&lt;p&gt;Corrected some grammatical errors.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
This page is about logging various information in log files and streams.&lt;br /&gt;
&lt;br /&gt;
= Logging in RT =&lt;br /&gt;
&lt;br /&gt;
Logging in RT is controlled from [[SiteConfig]] file with several LogXxx options, such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Set($LogToSyslog    , &amp;#039;info&amp;#039;);&lt;br /&gt;
Set($LogToScreen    , &amp;#039;info&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
Set($LogToFile , &amp;#039;debug&amp;#039;); #debug is very noisy&lt;br /&gt;
Set($LogDir, &amp;#039;/var/log/request-tracker3.8&amp;#039;);&lt;br /&gt;
Set($LogToFileNamed , &amp;quot;rt.log&amp;quot;);    #log to rt.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Available log levels ==&lt;br /&gt;
&lt;br /&gt;
Here is the list of available log levels:&lt;br /&gt;
&lt;br /&gt;
* debug&lt;br /&gt;
* info&lt;br /&gt;
* notice&lt;br /&gt;
* warning&lt;br /&gt;
* error&lt;br /&gt;
* critical&lt;br /&gt;
* alert&lt;br /&gt;
* emergency&lt;br /&gt;
&lt;br /&gt;
RT almost doesn&amp;#039;t use the alert and emergency levels, so critical is the highest. The debug log level is very noisy.&lt;br /&gt;
&lt;br /&gt;
== Available logging streams ==&lt;br /&gt;
&lt;br /&gt;
In RT you can log to syslog, screen (console/server&amp;#039;s log) and into a file.&lt;br /&gt;
&lt;br /&gt;
In production environment it&amp;#039;s recommended to log to screen and/or syslog.&lt;br /&gt;
&lt;br /&gt;
=== Logging into syslog ===&lt;br /&gt;
&lt;br /&gt;
This way is recommended in production environment, but don&amp;#039;t turn off logging to screen completly.&lt;br /&gt;
&lt;br /&gt;
 Set($LogToSyslog, &amp;quot;warning&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
You can tune logging into syslog with @LogToSyslogConf option. Here a few examples:&lt;br /&gt;
&lt;br /&gt;
Change ident (&amp;#039;RT&amp;#039; by default):&lt;br /&gt;
&lt;br /&gt;
  Set(@LogToSyslogConf, ident =&amp;gt; &amp;#039;RTTEST&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
Connect to remote syslog (requires Sys::Syslog 0.28 or newer):&lt;br /&gt;
&lt;br /&gt;
  Set(@LogToSyslogConf, socket =&amp;gt; [{type =&amp;gt; &amp;#039;udp&amp;#039;, host =&amp;gt; &amp;#039;logger.example.com&amp;#039;, port =&amp;gt; 12345 }]);&lt;br /&gt;
&lt;br /&gt;
Details about socket option you can read&lt;br /&gt;
[http://search.cpan.org/dist/Sys-Syslog/Syslog.pm#setlogsock in the module&amp;#039;s documentation].&lt;br /&gt;
Just put what the page describes in the following template:&lt;br /&gt;
&lt;br /&gt;
  Set(@LogToSyslogConf, socket =&amp;gt; [... setlogsock options here ...]);&lt;br /&gt;
&lt;br /&gt;
Change facility:&lt;br /&gt;
&lt;br /&gt;
  Set(@LogToSyslogConf, facility =&amp;gt; &amp;#039;local0&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
All combined:&lt;br /&gt;
&lt;br /&gt;
  Set(@LogToSyslogConf,&lt;br /&gt;
      ident =&amp;gt; &amp;#039;RTTEST&amp;#039;,&lt;br /&gt;
      facility =&amp;gt; &amp;#039;local0&amp;#039;,&lt;br /&gt;
      socket =&amp;gt; [{type =&amp;gt; &amp;#039;udp&amp;#039;, host =&amp;gt; &amp;#039;logger.example.com&amp;#039;, port =&amp;gt; 12345 }],&lt;br /&gt;
  );&lt;br /&gt;
&lt;br /&gt;
=== Logging to screen (console/server&amp;#039;s log) ===&lt;br /&gt;
&lt;br /&gt;
Log messages can be logged to screen (STDERR). When we talk about the web UI these messages usually end up in server&amp;#039;s log (at least for apache) and for command utilities it&amp;#039;s console.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Don&amp;#039;t disable&amp;#039;&amp;#039;&amp;#039; this type of logging completly. Some command line scripts may fail silently if this type of logging is disabled as they log errors instead of printing them directly.&lt;br /&gt;
&lt;br /&gt;
 Set($LogToScreen, &amp;quot;warning&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
=== Logging into standalone file ===&lt;br /&gt;
&lt;br /&gt;
This is useful on development setup. &amp;#039;&amp;#039;&amp;#039;Don&amp;#039;t use in production&amp;#039;&amp;#039;&amp;#039;, especially if people run command line scripts on the server as those scripts would fail unable to open the log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Set($LogToFile,      &amp;#039;debug&amp;#039;);&lt;br /&gt;
Set($LogToFileNamed, &amp;#039;rt.log&amp;#039;);&lt;br /&gt;
Set($LogDir,         &amp;#039;/opt/rt3/var/log&amp;#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In shell&lt;br /&gt;
&lt;br /&gt;
 touch /opt/rt3/var/log/rt.log&lt;br /&gt;
 chown apache:apache /opt/rt3/var/log/rt.log&lt;br /&gt;
&lt;br /&gt;
== Additional logging options ==&lt;br /&gt;
&lt;br /&gt;
=== Log SQL queries ===&lt;br /&gt;
&lt;br /&gt;
StatementLog option allows you to log all SQL queries RT runs per request to the server. Yes, it only works with web UI.&lt;br /&gt;
&lt;br /&gt;
 Set( $StatementLog, &amp;#039;debug&amp;#039; ); # statements would be logged at debug level&lt;br /&gt;
&lt;br /&gt;
See also &amp;quot;Logging in MySQL&amp;quot; below for alternatives.&lt;br /&gt;
&lt;br /&gt;
=== Log stack traces ===&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s possible to add stack traces to messages that are logged. Useful to report errors and for figuring out chain of calls that caused a problem.&lt;br /&gt;
&lt;br /&gt;
 # add stack traces to error messages and messages with higher priority&lt;br /&gt;
 Set($LogStackTraces, &amp;#039;error&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
= Logging in MySQL =&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s not complete documentation on logging in MySQL, but most useful things for RT admin.&lt;br /&gt;
&lt;br /&gt;
== Logging slow queries ==&lt;br /&gt;
&lt;br /&gt;
This is useful to debug perfomance issues.&lt;br /&gt;
&lt;br /&gt;
In MySQL conf (usually /etc/my.cnf)&lt;br /&gt;
&lt;br /&gt;
 [mysqld]&lt;br /&gt;
 log-slow-queries=/var/log/mysql_slow.log&lt;br /&gt;
 long_query_time=1 # time in seconds&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; MySQL perfomance is OK when 2-seconds log is empty.&lt;br /&gt;
&lt;br /&gt;
RT itself can log SQL queries with timings. It only works in the web UI and logs all queries, but time reported has higher resolution. Look at StatementLog above.&lt;br /&gt;
&lt;br /&gt;
== Logging all queries ==&lt;br /&gt;
&lt;br /&gt;
This is useful when RT generates wrong queries. This is useful when you expect some results shown, but RT skips data.&lt;br /&gt;
&lt;br /&gt;
Edit MySQL conf (usually /etc/my.cnf)&lt;br /&gt;
&lt;br /&gt;
 [mysqld]&lt;br /&gt;
 log=/var/log/mysql_full.log&lt;br /&gt;
&lt;br /&gt;
Then in shell&lt;br /&gt;
&lt;br /&gt;
 touch /var/log/mysql_full.log&lt;br /&gt;
 chown mysql:mysql /var/log/mysql_full.log&lt;br /&gt;
&lt;br /&gt;
Restart MySQL&lt;br /&gt;
&lt;br /&gt;
A request to the server usually starts from string: &amp;lt;code&amp;gt;SELECT GET_LOCK(&amp;#039;Apache-Session-...&amp;#039;, ...)&amp;lt;/code&amp;gt; Ends with &amp;lt;code&amp;gt;SELECT RELEASE_LOCK(&amp;#039;Apache-Session-...&amp;#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; Don&amp;#039;t turn on on production servers for long time.&lt;br /&gt;
&lt;br /&gt;
For full info see &amp;#039;Logging&amp;#039; section in [[SiteConfig]]&lt;br /&gt;
[[Category:documentation]]&lt;br /&gt;
[[Category:config]]&lt;br /&gt;
[[Category:logging]]&lt;/div&gt;</summary>
		<author><name>128.82.44.7</name></author>
	</entry>
</feed>