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 蓝桥oj3931,请问我错在哪里
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染