I created an action module in RT. And I want to output the RT Logger into text file. I already configured RT_SiteConfig.pm with:
Set($LogToSyslog , 'info');
Set($LogToScreen , 'info');
Set($LogToFile , 'debug');
Set($LogToFile, 'info');
Set($LogToFile, 'warning');
Set($LogToFile, 'error');
Set($LogDir, '/tmp');
Set($LogToFileNamed , "rt.log");
And I created action module:
package RT::Action::SetLoggingInfo;
use strict;
use warnings;
use base 'RT::Action';
sub Prepare {
my $self = shift;
$RT::Logger->info('Logging info');
$RT::Logger->info('Logging dump info');
return 1; # True if Commit should run, false if not
}
sub Commit {
my $self = shift;
return 1;
}
1;
And all I want it output the string inside RT::Logger to the logging file (rt.log) in /tmp. But it doesn't work, whenever I tried to create object in the web cli, there's nothing log in the rt.log file. I was testing in the rt-test server, not in production. I would likely have this kind of results.
Can you help me how to achieve this? Thanks so much.
IMHO you have too many directives $LogToFile
in your config file. There should be only one of this type, if not, the last takes all. So you've set to log the errors
but your module logs info
. Consult the documentation to see how the log levels work. If you set log level to error, the logging process omits all debug, info, notice and warning events.