当前位置: 首页 > news >正文

电商网站开发的目的是龙岩网站建

电商网站开发的目的是,龙岩网站建,ps做网站难吗,搭建网站平台需要多少钱什么是JCatch当程序发生异常(Exception)#xff0c;处理方式一般是通过日志文件记录下来#xff0c;这种方式很容易被忽略#xff0c;而且查询起来比较麻烦。JCatch提供了一种方案#xff0c;当程序发生异常时#xff0c;通过JCatch平台接口提交到JCatch平台#xff0c;由…什么是JCatch当程序发生异常(Exception)处理方式一般是通过日志文件记录下来这种方式很容易被忽略而且查询起来比较麻烦。JCatch提供了一种方案当程序发生异常时通过JCatch平台接口提交到JCatch平台由JCatch平台统一管理所有异常这样可以方便查询并且JCatch平台提供异常监控功能当应用程序发生异常时会以邮件方式提醒相关人员。应用列表:应用配置:异常列表:Java异常详情:PHP异常:邮件通知:运行/部署JCatchMySQL数据库使用MySQL数据库执行doc/sql.sql中的SQL脚本创建表修改src/main/resources/MyBatis.xml文件中的数据库连接配置登录管理员账户默认管理员账户 用户名 admin 密码 xxg管理员登录基于Spring Security实现可以配置src/main/resources/springSecurity.xml文件支持邮件订阅功能邮件订阅功能会在应用发生异常时每小时发送一封邮件给应用订阅者邮件内容为这个小时内的异常信息配置src/main/resources/messageService.xml支持邮件订阅打包mvn package命令生成war包可部署在Tomcat、Jetty等服务器中运行MyBatis Generator生成代码如果二次开发需要修改表结构, 修改src/main/resources/generatorConfig.xml文件中的数据库连接, com.xxg.jcatch.mbg包下代码是通过MyBatis Generator自动生成的可以运行mvn mybatis-generator:generate命令生成代码API提交一条ExceptionURL: http://[your baseUrl]/api/submitExceptionJson?appId[your appId]请求类型: POST请求Body:{fileName: Main.java,methodName: main,className: com.xxg.jcatch.Main,stackTrace: java.lang.ArithmeticException: / by zero\n\tat com.xxg.jcatch.Main.main(Main.java:16)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)\n,message: / by zero,lineNumber: 16,exceptionName: java.lang.ArithmeticException}响应Body:{success: true}客户端接入JavaPHP通用function submitToJCatch($e) {$json json_encode($e);$ch curl_init(http:///api/submitExceptionJson?appId);curl_setopt_array($ch, array(CURLOPT_POST TRUE,CURLOPT_RETURNTRANSFER TRUE,CURLOPT_HTTPHEADER array(Content-Type: application/json),CURLOPT_POSTFIELDS $json,CURLOPT_CONNECTTIMEOUT 2,CURLOPT_TIMEOUT 4,));curl_exec($ch);}function error_handler($errno, $errstr, $errfile, $errline) {submitToJCatch(array(message $errstr,fileName $errfile,lineNumber $errline,));}function exception_handler($exception) {submitToJCatch(array(fileName $exception-getFile(),lineNumber $exception-getLine(),stackTrace $exception-getTraceAsString(),message $exception-getMessage(),exceptionName get_class($exception)));}set_error_handler(error_handler);set_exception_handler(exception_handler);PHP的错误和异常会通过set_error_handler、set_exception_handler指定的函数来处理一般PHP框架都会有自己的一套错误处理机制如果使用PHP框架建议通过框架本身的错误处理机制来提交错误到JCatch下面有各个框架接入JCatch的方法。Laravel修改App/Exceptions/Handler.php文件:public function report(Exception $exception){$appId ;$submitUrl http:///api/submitExceptionJson?appId . $appId;$data json_encode([fileName $exception-getFile(),lineNumber $exception-getLine(),stackTrace $exception-getTraceAsString(),message $exception-getMessage(),exceptionName get_class($exception)]);$ch curl_init($submitUrl);curl_setopt_array($ch, array(CURLOPT_POST TRUE,CURLOPT_RETURNTRANSFER TRUE,CURLOPT_HTTPHEADER array(Content-Type: application/json),CURLOPT_POSTFIELDS $data,CURLOPT_CONNECTTIMEOUT 2,CURLOPT_TIMEOUT 4,));curl_exec($ch);return parent::report($exception);}CodeIgniter 3.x在application/core目录下新建文件MY_Exceptions.php代码如下class MY_Exceptions extends CI_Exceptions{public function log_exception($severity, $message, $filepath, $line){parent::log_exception($severity, $message, $filepath, $line);$json json_encode(array(message $message,fileName $filepath,lineNumber $line));$ch curl_init(http:///api/submitExceptionJson?appId);curl_setopt_array($ch, array(CURLOPT_POST TRUE,CURLOPT_RETURNTRANSFER TRUE,CURLOPT_HTTPHEADER array(Content-Type: application/json),CURLOPT_POSTFIELDS $json,CURLOPT_CONNECTTIMEOUT 2,CURLOPT_TIMEOUT 4,));curl_exec($ch);}}当发生错误或异常时CI框架会自动调用以上代码将异常信息提交到JCatch API。Yii 1.1在protected/components目录下新建文件ErrorHandler.php代码如下class ErrorHandler extends CErrorHandler{public $jcatchBaseUrl;public $jcatchAppId;public $jcatchSecretKey;protected function handleException($exception){parent::handleException($exception);$this-submitToJCatch(array(fileName $exception-getFile(),lineNumber $exception-getLine(),stackTrace $exception-getTraceAsString(),message $exception-getMessage(),exceptionName get_class($exception)));}protected function handleError($event){parent::handleError($event);$this-submitToJCatch(array(message $event-message,fileName $event-file,lineNumber $event-line,));}private function submitToJCatch($e) {$json json_encode($e);$ch curl_init($this-jcatchBaseUrl./api/submitExceptionJson?appId.$this-jcatchAppId);curl_setopt_array($ch, array(CURLOPT_POST TRUE,CURLOPT_RETURNTRANSFER TRUE,CURLOPT_HTTPHEADER array(Content-Type: application/json),CURLOPT_POSTFIELDS $json,CURLOPT_CONNECTTIMEOUT 2,CURLOPT_TIMEOUT 4,));curl_exec($ch);}}修改所使用的配置文件例如protected/config/main.phperrorHandlerarray(errorActionsite/error,classErrorHandler,jcatchBaseUrl,jcatchAppId,jcatchSecretKey,),当发生错误或异常时Yii框架会自动调用ErrorHandler来处理异常将异常信息提交到JCatch API。
http://wiki.neutronadmin.com/news/315754/

相关文章:

  • 网站建设服务网络服务wordpress百度网盘插件
  • element-ui网站开发广告推广方式
  • 安徽住房和建设厅网站搜狗网
  • 网站做装修x3型虚拟主机 wordpress
  • 江津网站建设口碑欧美平面设计网站
  • 网站建设7个基网站做全景图
  • 齐齐哈尔市网站建设宣传片拍摄流程文案
  • 学校 html5 网站 案例网络营销策略的特点
  • 云南建设工程信息网站江苏省交通建设局网站
  • 四川网站建设 lkcmswordpress能建商城吗
  • 网站备案要如何取消潜江网站设计公司
  • 怎样给企业做网站北京微网站建设设计服务
  • 做网站选择什么服务器企业网站建设招标技术标准
  • 电子商务的网站建设设计书深圳龙岗企业网站建设
  • 东莞公司想建网站软件开发工具框图
  • 建设网站的公司的官网wordpress king模板
  • 公司做网站的步骤五指山住房建设局网站
  • 高端网站建设公司费用wordpress红色主题公园
  • iis6 静态网站进入公众号会有记录吗
  • 阿凡达网站设计洛阳恢复客运最新通知
  • 重庆交通建设集团有限公司网站网站-网站建设定制
  • 目前做美术的网站以及app如何提高网站内容质量
  • 苏州网站推广排名服务公司口号
  • 行业网站策划青岛营销型网站推广
  • vs网站开发实例百度推广费用怎么算
  • 大学一学一做视频网站百度安装app下载免费
  • 联想网络营销推广方法147seo工具
  • 国外创意型网站设计网页浏览器包括
  • 开源的网站系统网上做网站接活怎么样
  • 八步网站建设什么是搜索引擎优化用一句话概括