Can we create custom logs files in Sugar CRM through its own methods?

跟風遠走 提交于 2019-12-12 04:54:01

问题


Actually I work on a Sugar CRM package which is for Sugar On Demand. In this package Sugar CRM On Demand does not allow file handling PHP functions But I want to create separate log files for my package.

Is there a way in Sugar CRM to create our separate Custom log files through Sugar CRM internal libraries without disturbing Sugar CRM default logs.


回答1:


You can use the great proposition from Jason, however if you want to stay on your idea to have your own logger you can try that : https://gist.github.com/cmourizard/3e3762bbf709ef4b05e0




回答2:


You probably could, but another solution is to be able to set your package on a different logger level. We do this with SugarChimp and it's extremely helpful. You can have the rest of the application on "debug" while turning your package to "fatal" so that just your logs get logged to sugarcrm.log. You just abstract the built in SugarCRM logger with your own.

So instead of:

$GLOBALS['log']->fatal('MyPackage::my_function check point');

You can do:

MyPackage::log('fatal','MyPackage::my_function check point');

Then in your log function do your logic to check what your package's logger level is set to and call the appropriate SugarLogger function. Also provide a way to change/set that logger level such as through the UI.



来源:https://stackoverflow.com/questions/26143788/can-we-create-custom-logs-files-in-sugar-crm-through-its-own-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!