From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 704DD1BA00A1 for ; Wed, 10 May 2017 18:16:44 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id AAE40B5D8EE for ; Wed, 10 May 2017 19:00:37 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 71C3418CC819 for ; Wed, 10 May 2017 19:00:38 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 833A91206B2; Wed, 10 May 2017 19:00:36 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 68FD21205E0 for ; Wed, 10 May 2017 19:00:33 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=L8+oFlg+cDIaXolL2UGwhcKNdPc=; b=NTLsdCJXNZ8NAso/Jy DAt4UkzYych61bXzEfRSSWzX3wKtovLntA8yy0NsAeX4qS+Ui8U5SOXTR1BxwZGR WyYFAf5c6t+w9RgfwrPOEdfyPZn8yxfVHAWu5k1RGAoWqMKSvz4M1Sk6A+8YUEn5 bNi2Tc4FGBLLfskjNOTeeXLIA= Received: by filter0490p1las1.sendgrid.net with SMTP id filter0490p1las1-19046-5912E4BB-1E 2017-05-10 10:00:27.478716065 +0000 UTC Received: from herokuapp.com (ec2-54-162-57-59.compute-1.amazonaws.com [54.162.57.59]) by ismtpd0001p1sjc2.sendgrid.net (SG) with ESMTP id SuSfX-EgQmmWqr2V0EjbZA Wed, 10 May 2017 10:00:27.363 +0000 (UTC) Date: Wed, 10 May 2017 10:00:26 +0000 From: eregontp@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56112 X-Redmine-Project: common-ruby X-Redmine-Issue-Id: 8661 X-Redmine-Issue-Author: gary4gar X-Redmine-Sender: Eregon X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4q+HQvR9ofGz9helYo5hIsvnJWsop5vfC259 7j1TXRMb1XdsUPakshxY0IQ1nMHMlMayHOG3TXb/MXuUJijSlGBHJvD37p1CdHerTmBg2kLmsS8KqN U9I50Bic+ls4ogwOhfMMzc7hc0o1kQQxuysS/o3QOvfmD2yD44BnZo9M3g== X-ML-Name: ruby-core X-Mail-Count: 81087 Subject: [ruby-core:81087] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last) X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #8661 has been updated by Eregon (Benoit Daloze). Should matz give an opinion on this feature? It's a pretty big change for the user, I got confused a couple times by it when running trunk. Particularly, if a test framework prints a backtrace in the old order, but then some exception kills the test framework then there is a mix of backtrace in old and new order. I see from the commit this is limited to top-level backtraces printed to stderr. This is good to limit breaking compatibility but also inconsistent with the Exception#backtrace order for instance. Even then, it might already break compatibility significantly if anyone depends on the output of the top-level exception handler. Also, I am not sure this addresses the OP concern, since the display of the backtrace in Rails is rarely an exception going to the top-level (which would be affected by this change) but managed by some handler printing the exception in the log (managed by Rails and can only be changed there). In any case, if this remains for 2.5 it should be mentioned in the NEWS file. ---------------------------------------- Feature #8661: Add option to print backstrace in reverse order(stack frames first & error last) https://bugs.ruby-lang.org/issues/8661#change-64737 * Author: gary4gar (Gaurish Sharma) * Status: Closed * Priority: Normal * Assignee: * Target version: ---------------------------------------- Currently the way ruby prints the backtrace is that the error comes first & then the stack frames. like this ``` Main Error Message stack frame 1 stack frame 2 stack frame 3 ..... ``` this is perfectly fine provided 1. Backstraces are short, so fits in terminal.hence, no need to scroll. 2. you read it from top to bottom. But, I am a rails developer where 1. Backstraces are always HUGE, therefore seldom don't fit in terminal. Means LOTS of scrolling to do everytime we get an error. 2. in terminal we tend to read backstraces from bottom to top, especially when tailing(tail -f) the production logs. 3. people, who practice Test-driven development literally spend most of their time scrolling to read backstraces to the point most end up buying a larger display. Proposed Solution: Please add a way so we can configure backstraces to be printed in reverse order. so if you are reading from bottom, say from terminal, you can get the main error message without need to scroll. like this ``` stack frame 3 stack frame 2 stack frame 1 Main Error Message ..... ``` this would save lot of time because when the error message is print at the bottom, no need to scroll for reading it. Not sure if this can be done today. I tried Overriding Exception#backtrace but it caused stack level too deep & illegal hardware instruction Error. Attached are currently what backstrace currently looks like & how there be an option to make it look for comparison. ---Files-------------------------------- current.log (5.13 KB) proposed.log (4.9 KB) -- https://bugs.ruby-lang.org/