stack-trace

What does <init> signify in a Java exception?

落爺英雄遲暮 提交于 2019-12-18 04:34:29
问题 What does <init> signify in a Java exception? For example: BlahBlahException... at java.io.FileInputStream.<init>(FileInputStream.java:20) 回答1: That the exception is thrown in the construction of the object, there are two options: in the constructor while initializing variables Check out this demo I wrote: http://ideone.com/Mm5w5 class Main { public static void main (String[] args) throws java.lang.Exception { try { new Test(); } catch (Exception e) { e.printStackTrace(); } try { new Test2();

Is there a way to examine the stack variables at runtime in C#?

冷暖自知 提交于 2019-12-18 04:21:41
问题 Is there a way to dump the contents of the stack at runtime? I am interested in both the parent functions information (name, parameters, line) which I know I can get with the StackTrace and StackFrame classes. However, I would also like to get the variables in the stack (local variables declared in the method that called the one is currently executing). Since the Visual Studio debugger can do this, I think there may be a way to also do it at runtime within the code. Is there such a way? 回答1:

Is there a way to examine the stack variables at runtime in C#?

五迷三道 提交于 2019-12-18 04:21:04
问题 Is there a way to dump the contents of the stack at runtime? I am interested in both the parent functions information (name, parameters, line) which I know I can get with the StackTrace and StackFrame classes. However, I would also like to get the variables in the stack (local variables declared in the method that called the one is currently executing). Since the Visual Studio debugger can do this, I think there may be a way to also do it at runtime within the code. Is there such a way? 回答1:

Cleaning noise out of Java stack traces

梦想的初衷 提交于 2019-12-18 03:49:09
问题 My Java stack traces have a lot of entries that I don't care about, showing method invocation going through proxies and Spring reflection methods and stuff like that. It can make it pretty hard to pick out the part of the stack trace that's actually from my code. Ruby on Rails includes a "stack trace cleaner" where you can specify a list of stack trace patterns to omit from printed stack traces - what's the best way to do something like that, universally, for Java? It'd be best if this worked

Error-logging for javascript on client side

落爺英雄遲暮 提交于 2019-12-17 22:34:16
问题 My project which contains a lot of pages with forms. This is a backend of banking CRM system, so any error during working process is to be captured and investigated. On the server side we have enhanced java exceptions system, but if error occurs on client side - javascript the only info we now get is an js-error window in IE or sometimes a screenshot of page made by advanced user. Javascript code contains both Jquery-powered UI extensions and hard-coded inline event handlers and functions. So

Getting full string stack trace including inner exception

陌路散爱 提交于 2019-12-17 19:19:42
问题 Java's e.printStackTrace() doesn't print all the details of the inner exception's stack trace. Is there a ready way to generate the complete stack trace in string form? (besides formatting it myself) Edit I just found out what printStackTrace() does - apparently the stack frames it filters out are exactly the ones common to the inner exception and the outer one. So in fact it is rather what I want, and not the 'full' stack trace. 回答1: I suggest that you use the ExceptionUtils class from

e.printStackTrace equivalent in python

廉价感情. 提交于 2019-12-17 17:26:17
问题 I know that print(e) (where e is an Exception) prints the occurred exception but, I was trying to find the python equivalent of Java's e.printStackTrace() that exactly traces the exception to what line it occurred and prints the entire trace of it. Could anyone please tell me the equivalent of e.printStackTrace() in Python? 回答1: import traceback traceback.print_exc() When doing this inside an except ...: block it will automatically use the current exception. See http://docs.python.org/library

c++ stack trace from unhandled exception?

六眼飞鱼酱① 提交于 2019-12-17 15:27:46
问题 This question has been asked before and there have been windows-specific answers but no satisfactory gcc answer. I can use set_terminate() to set a function that will be called (in place of terminate() ) when an unhandled exception is thrown. I know how to use the backtrace library to generate a stack trace from a given point in the program. However, this won't help when my terminate-replacement is called since at that point the stack has been unwound. Yet if I simply allow the program to

Log4j formatting: Is it possible to truncate stacktraces?

只谈情不闲聊 提交于 2019-12-17 09:38:13
问题 I want to log only the first few lines of Exceptions in my program. I know, I can do something like this to print only the first 5 lines of a stacktrace: Throwable e = ...; StackTraceElement[] stack = e.getStackTrace(); int maxLines = (stack.length > 4) ? 5 : stack.length; for (int n = 0; n < maxLines; n++) { System.err.println(stack[n].toString()); } But I would rather use log4j (or slf4j over log4j to be more precise) for logging. Is there a way to tell log4j that it should only print the

How to send a stacktrace to log4j?

六眼飞鱼酱① 提交于 2019-12-17 07:13:33
问题 Say you catch an exception and get the following on the standard output (like, say, the console) if you do a e.printStackTrace() : java.io.FileNotFoundException: so.txt at java.io.FileInputStream.<init>(FileInputStream.java) at ExTest.readMyFile(ExTest.java:19) at ExTest.main(ExTest.java:7) Now I want to send this instead to a logger like, say, log4j to get the following: 31947 [AWT-EventQueue-0] ERROR Java.io.FileNotFoundException: so.txt 32204 [AWT-EventQueue-0] ERROR at java.io