paip. 调试技术打印堆栈 uapi print stack java php python 总结.





作者Attilax  艾龙,  EMAIL:1466519819@qq.com

来源:attilax的专栏

地址:http://blog.csdn.net/attilax





---------uapi

打印堆栈:printStack    god.printstack()

得到堆栈String:getStack





----------------php,

debug_print_backtrace(),加入error line的前面行上...

保存stack到文件:print_r(debug_backtrace());









C:\phpdeskc9>D:\wamp\php\php.exe  E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some

_dir.php E:\OfflineExplorerPortable\Download budejie,xiaohua

#0  c() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:31]

#1  b() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:27]

#2  a() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:38]





Fatal error: Call to undefined function d() in E:\DedeCMS-V5.7-UTF8-SP1-Full\upl

oads\del_some_dir.php on line 35









 debug_backtrace() 函数生成一个 backtrace。[1]

该函数返回一个关联数组









------------java 

e.printStackTrace() 





保存stack到文件,方法1

StackTraceElement [] messages=ex.getStackTrace();

   int length=messages.length;

   for(int i=0;i<length;i++){

    System.out.println("ClassName:"+messages[i].getClassName());

    System.out.println("getFileName:"+messages[i].getFileName());

    System.out.println("getLineNumber:"+messages[i].getLineNumber());

    System.out.println("getMethodName:"+messages[i].getMethodName());

    System.out.println("toString:"+messages[i].toString());

    }

   }

   

 保存stack到文件,方法2

public String getTrace(Throwable t) {

        StringWriter stringWriter= new StringWriter();

        PrintWriter writer= new PrintWriter(stringWriter);

        t.printStackTrace(writer);

        StringBuffer buffer= stringWriter.getBuffer();

        return buffer.toString();

    }





------------python

info = traceback.format_exc()

print info





参考:

python异常处理及异常信息追踪 - 趣客(放糖的绿豆汤) - Power by SupDo!.htm

paip. 调试技术打印堆栈 uapi print stack java php python 总结.的更多相关文章

  1. paip. uapi 过滤器的java php python 实现aop filter

    paip. uapi 过滤器的java php python 实现aop filter filter 是面向切面编程AOP.. 作者Attilax  艾龙,  EMAIL:1466519819@qq. ...

  2. 【转】Linux Shell脚本调试技术

    本文转载自:https://www.ibm.com/developerworks/cn/linux/l-cn-shell-debug/ Shell脚本调试技术 本文全面系统地介绍了shell脚本调试技 ...

  3. shell脚本调试技术_转

    转自:http://itlab.idcquan.com/linux/SHELL/727128.html 参考:https://linux.cn/article-8045-1.html 本文全面系统地介 ...

  4. 掌握 Linux 调试技术

    掌握 Linux 调试技术 在 Linux 上找出并解决程序错误的主要方法 Steve Best (sbest@us.ibm.com)JFS 核心小组成员,IBM 简介: 您可以用各种方法来监控运行着 ...

  5. Shell脚本调试技术

    http://www.ibm.com/developerworks/cn/linux/l-cn-shell-debug/ 一. 前言 shell编程在unix/linux世界中使用得非常广泛,熟练掌握 ...

  6. iOS 开发者旅途中的指南针 - LLDB 调试技术

    文章转载于:iOS 开发者旅途中的指南针 - LLDB 调试技术 今天给大家介绍的内容,无关乎任何功能性开发技术,但又对开发的效率影响至深,这就是调试技术. 何为调试呢,比如我们用 print 函数在 ...

  7. Linux kprobe调试技术使用

    kprobe调试技术是为了便于跟踪内核函数执行状态所设计的一种轻量级内核调试技术. 利用kprobe技术,可以在内核绝大多数函数中动态插入探测点,收集调试状态所需信息而基本不影响原有执行流程. kpr ...

  8. Linux内核调试技术——jprobe使用与实现

    前一篇博文介绍了kprobes的原理与kprobe的使用与实现方式,本文介绍kprobes中的另外一种探測技术jprobe.它基于kprobe实现,不能在函数的任何位置插入探測点,仅仅能在函数的入口处 ...

  9. linux内核调试技术之printk

    原创博客:欢迎转载,转载请注明出处https://i.cnblogs.com/EditPosts.aspx?postid=6218383 1.简介(基于s3c2440 linux) 在内核调试技术之中 ...

随机推荐

  1. C语言学习笔记(一)_hello world

    一.建立一个文件a.c,写入: #include <stdio.h> //使用printf库函数之前,必须include <stdio.h>int main()//main函数 ...

  2. eclipse4.x 启动之后, "Initializing Java Tooling" 卡住问题解决

    eclipse4.x 启动之后, "Initializing Java Tooling(1%)",其他操作均被阻塞,导致无法正常工作, 解决方案: 删除当前工作目录下的worksp ...

  3. DataGridView的DataGridViewComboBoxColumn列在编辑时自动弹出下拉列表

    在DataGridView的CellEnter的事件中添加如下代码即可: if (e.ColumnIndex == dataGridView1.Columns["仓库名"].Ind ...

  4. 第三十五章 metrics(3)- codahale-metrics基本使用

    <!-- metrics --> <dependency> <groupId>io.dropwizard.metrics</groupId> <a ...

  5. const限定符

    1 const的作用 便于进行类型检查.可以保护被修饰的东西.避免不必要的内存分配.为函数重载提供一个参考. 2 const成员函数 const成员函数只能访问数据成员的值,而不能修改他. #incl ...

  6. 边表+SPFA (使用指针+动态内存)

    233 只是我怕忘了怎么写指针操作 所以写一遍指针版的 然而洛谷评测机不给力,400多ms过了数组的,600多ms过指针的... 我想,指针的比数组的理解起来应该容易一点吧 戳我是数组版的,NOIP时 ...

  7. aix 6+ mount 光驱

    AIX 挂载光驱的方法 系统环境: [root@Big A:/1]#oslevel -s6100-06-00-0000 [root@Big A:/]#crfs -v cdrfs -p ro -d '/ ...

  8. Points on cycle

    Description There is a cycle with its center on the origin. Now give you a point on the cycle, you a ...

  9. php openssl 增加密钥

      生成私钥:openssl genrsa 1024 > private.key (注意,1024是密钥的长度,如果密钥较长,相应加密后的密文也会较长) 生成公钥:openssl rsa -in ...

  10. Ubuntu和Windows的交互工具---Samba环境配置

    Samba软件安装 使用源代码安装samba,在终端输入如下指令: #sudo apt-get install samba #sudo apt-get install smbclient #sudo ...