【问题标题】:RT LOGGER not writing to a file [RT]RT LOGGER 未写入文件 [RT]
【发布时间】: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模块及其相关的链接源代码。这将有助于澄清您的问题。

标签: perl rt


【解决方案1】:

恕我直言,您的配置文件中有太多指令$LogToFile。这种类型应该只有一个,如果没有,最后一个通吃。因此,您已设置记录errors,但您的模块记录info。请咨询documentation 以了解日志级别的工作方式。如果您将日志级别设置为错误,则日志记录过程会忽略所有调试、信息、通知和警告事件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-21
    • 1970-01-01
    • 1970-01-01
    • 2014-05-27
    • 2023-01-22
    • 2012-12-02
    相关资源
    最近更新 更多