dongzhuo5185 2017-01-20 11:04
浏览 68
已采纳

如何在TYPO3后端写入登录?

I would like to debug backend and need to write some logs. I tried the code belowed but it is not working, it doesn't write anything ! Can you help me ?

var $logger;

    public function __construct()
    {
        parent::__construct();
        // desactiver le cache sinoin les FE plugins ne sont pas réactualisé
        // desactivation dans le backend modifie des liens en ajoutant '/no_cache/' devant le lien
        // les liens deviennent inutilisables
        $GLOBALS['TSFE']->set_no_cache();
        $this->logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
        $this->logger->info('Everything went fine.');
    }
  • 写回答

3条回答 默认 最新

  • dsyrdwdbo47282676 2017-01-20 11:26
    关注

    Try following PHP, adapt your extension-key and choose error-level

    // Log message
    $logMessage = 'Everything went fine.';
    // Option extension key / module name
    $extKey = 'my_extension';
    // Error-level: 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
    $errorLevel = 0;
    // Write sys_log using \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog
    $GLOBALS['BE_USER']->simplelog($logMessage, $extKey, $errorLevel);
    

    Then you will find your message with timestamp and further informations in sys_log table or in BE modul with name 'Log'.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 脱敏项目合作,ner需求合作
  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴