【发布时间】:2021-08-21 03:19:57
【问题描述】:
我在 RT 中创建了一个动作模块。我想将 RT Logger 输出到文本文件中。我已经配置了 RT_SiteConfig.pm:
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");
我创建了动作模块:
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;
我只想将 RT::Logger 中的字符串输出到 /tmp 中的日志文件 (rt.log)。但它不起作用,每当我尝试在 web cli 中创建对象时,rt.log 文件中都没有任何日志。我在 rt-test 服务器中进行测试,而不是在生产中。我很可能会得到这种结果。
您能帮我实现这一目标吗?非常感谢。
【问题讨论】:
-
"all I want it output the string inside RT::Logger" 我对这个软件不熟悉,能否提供
RT::Logger模块及其相关的链接源代码。这将有助于澄清您的问题。