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条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP