ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: shyouhei@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81299] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
Date: Sat, 20 May 2017 02:14:10 +0000	[thread overview]
Message-ID: <redmine.journal-64972.20170520021410.9cb4ad128ccc6840@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-8661.20130721052006@ruby-lang.org

Issue #8661 has been updated by shyouhei (Shyouhei Urabe).


FYI it is intentional for this feature being automatically enabled right now, instead of some configuration like the OP requests.

The reason behind this is that stderr is expected to be passed to other processes (like some logging infrastructure for instance).  If the order of backtraces is configurable, it becoms impossible for such outer-process things to detect which.  So configuration is a bad idea in this area.  Either the backtrace is ascending or descending, that order should be static and should never be configurable.

P.S. I get confused too so I personally don't like the way it is.

----------------------------------------
Feature #8661: Add option to print backstrace in reverse order(stack frames first & error last)
https://bugs.ruby-lang.org/issues/8661#change-64972

* Author: gary4gar (Gaurish Sharma)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* 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/

  parent reply	other threads:[~2017-05-20  1:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-20 20:20 [ruby-core:56096] [CommonRuby - Feature #8661][Open] Add option to print backstrace in reverse order(stack frames first & error last) gary4gar (Gaurish Sharma)
2013-07-22 19:56 ` [ruby-core:56109] " Joshua Ballanco
2013-07-23  2:09   ` [ruby-core:56117] " Nobuyoshi Nakada
2016-12-22 22:50 ` [ruby-core:78808] [CommonRuby Feature#8661] " x
2017-02-22  8:49 ` [ruby-core:79669] " nobu
2017-05-10 10:00 ` [ruby-core:81087] " eregontp
2017-05-10 10:01 ` [ruby-core:81088] " eregontp
2017-05-11  6:11 ` [ruby-core:81100] [CommonRuby Feature#8661][Assigned] " ko1
2017-05-19  6:09 ` [ruby-core:81246] [CommonRuby Feature#8661] " naruse
2017-05-20  2:14 ` shyouhei [this message]
2017-10-03 13:06 ` [ruby-core:83088] " sonots
2017-11-29  7:46 ` [ruby-core:83953] " mame
2017-12-11 15:47 ` [ruby-core:84161] " kou
2017-12-24 15:09 ` [ruby-core:84428] " aeroastro007
2018-06-27  3:24 ` [ruby-core:87647] " samuel
2018-08-17 14:41 ` [ruby-core:88515] " mame
2018-08-18 17:45 ` [ruby-core:88545] " shevegen
2019-11-07  4:45 ` [ruby-core:95739] " mame

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-64972.20170520021410.9cb4ad128ccc6840@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).