ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:56096] [CommonRuby - Feature #8661][Open] Add option to print backstrace in reverse order(stack frames first & error last)
@ 2013-07-20 20:20 gary4gar (Gaurish Sharma)
  2013-07-22 19:56 ` [ruby-core:56109] " Joshua Ballanco
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: gary4gar (Gaurish Sharma) @ 2013-07-20 20:20 UTC (permalink / raw)
  To: ruby-core


Issue #8661 has been reported by gary4gar (Gaurish Sharma).

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

Author: gary4gar (Gaurish Sharma)
Status: Open
Priority: Normal
Assignee: 
Category: 
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.


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:56109] Re: [CommonRuby - Feature #8661][Open] Add option to print backstrace in reverse order(stack frames first & error last)
  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 ` Joshua Ballanco
  2013-07-23  2:09   ` [ruby-core:56117] " Nobuyoshi Nakada
  2016-12-22 22:50 ` [ruby-core:78808] [CommonRuby Feature#8661] " x
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 18+ messages in thread
From: Joshua Ballanco @ 2013-07-22 19:56 UTC (permalink / raw)
  To: ruby-core

[-- Attachment #1: Type: text/plain, Size: 2222 bytes --]

You can already accomplish something like this yourself:

    begin
      raise "Hello!"
    rescue Exception => e
      puts e.backtrace.reverse.join("\n")
      puts e.message
    end

Simple!


On Sat, Jul 20, 2013 at 11:20 PM, gary4gar (Gaurish Sharma) <
gary4gar@gmail.com> wrote:

>
> Issue #8661 has been reported by gary4gar (Gaurish Sharma).
>
> ----------------------------------------
> Feature #8661: Add option to print backstrace in reverse order(stack
> frames first & error last)
> https://bugs.ruby-lang.org/issues/8661
>
> Author: gary4gar (Gaurish Sharma)
> Status: Open
> Priority: Normal
> Assignee:
> Category:
> 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.
>
>
> --
> http://bugs.ruby-lang.org/
>
>

[-- Attachment #2: Type: text/html, Size: 3028 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:56117] Re: [CommonRuby - Feature #8661][Open] Add option to print backstrace in reverse order(stack frames first & error last)
  2013-07-22 19:56 ` [ruby-core:56109] " Joshua Ballanco
@ 2013-07-23  2:09   ` Nobuyoshi Nakada
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuyoshi Nakada @ 2013-07-23  2:09 UTC (permalink / raw)
  To: ruby-core

(13/07/23 4:56), Joshua Ballanco wrote:
> You can already accomplish something like this yourself:
> 
>     begin
>       raise "Hello!"
>     rescue Exception => e
>       puts e.backtrace.reverse.join("\n")

You don't need to join.

>       puts e.message
>     end
> 
> Simple!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:78808] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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
@ 2016-12-22 22:50 ` x
  2017-02-22  8:49 ` [ruby-core:79669] " nobu
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: x @ 2016-12-22 22:50 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by Marcos Piccinini.


Already doing the rescue & reverse, but need to do it on every project...

Another use case is when using some monitor (e.g. guard) to run tests as you code:
When there's a fail one needs to switch to terminal and scroll up to see the lines that matter.

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

* Author: Gaurish Sharma
* Status: Open
* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:79669] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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
  2016-12-22 22:50 ` [ruby-core:78808] [CommonRuby Feature#8661] " x
@ 2017-02-22  8:49 ` nobu
  2017-05-10 10:00 ` [ruby-core:81087] " eregontp
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu @ 2017-02-22  8:49 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by Nobuyoshi Nakada.

Description updated

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

* Author: Gaurish Sharma
* Status: Open
* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:81087] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (2 preceding siblings ...)
  2017-02-22  8:49 ` [ruby-core:79669] " nobu
@ 2017-05-10 10:00 ` eregontp
  2017-05-10 10:01 ` [ruby-core:81088] " eregontp
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: eregontp @ 2017-05-10 10:00 UTC (permalink / raw)
  To: 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:81088] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (3 preceding siblings ...)
  2017-05-10 10:00 ` [ruby-core:81087] " eregontp
@ 2017-05-10 10:01 ` eregontp
  2017-05-11  6:11 ` [ruby-core:81100] [CommonRuby Feature#8661][Assigned] " ko1
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: eregontp @ 2017-05-10 10:01 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by Eregon (Benoit Daloze).

Assignee set to matz (Yukihiro Matsumoto)

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:81100] [CommonRuby Feature#8661][Assigned] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (4 preceding siblings ...)
  2017-05-10 10:01 ` [ruby-core:81088] " eregontp
@ 2017-05-11  6:11 ` ko1
  2017-05-19  6:09 ` [ruby-core:81246] [CommonRuby Feature#8661] " naruse
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: ko1 @ 2017-05-11  6:11 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by ko1 (Koichi Sasada).

Status changed from Closed to Assigned

Agreed. I got confusing too. (not sure it is a matter of experience or not...)

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

* Author: gary4gar (Gaurish Sharma)
* Status: Assigned
* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:81246] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (5 preceding siblings ...)
  2017-05-11  6:11 ` [ruby-core:81100] [CommonRuby Feature#8661][Assigned] " ko1
@ 2017-05-19  6:09 ` naruse
  2017-05-20  2:14 ` [ruby-core:81299] " shyouhei
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: naruse @ 2017-05-19  6:09 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by naruse (Yui NARUSE).


We expect some people may object this.
Therefore we're gathering feedback now (so thank you for your feedback).

To gather feedback wider, we'll give final decision after preview 1, including rspec and Rails will follow this change or not.

> In any case, if this remains for 2.5 it should be mentioned in the NEWS file.

Yeah, NEWS should include this and note as EXPERIMENTAL.
I add it.

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

* Author: gary4gar (Gaurish Sharma)
* Status: Assigned
* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:81299] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (6 preceding siblings ...)
  2017-05-19  6:09 ` [ruby-core:81246] [CommonRuby Feature#8661] " naruse
@ 2017-05-20  2:14 ` shyouhei
  2017-10-03 13:06 ` [ruby-core:83088] " sonots
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: shyouhei @ 2017-05-20  2:14 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:83088] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (7 preceding siblings ...)
  2017-05-20  2:14 ` [ruby-core:81299] " shyouhei
@ 2017-10-03 13:06 ` sonots
  2017-11-29  7:46 ` [ruby-core:83953] " mame
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: sonots @ 2017-10-03 13:06 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by sonots (Naotoshi Seo).


I object the current behavior which prints backtrace in reverse order for STDERR. It is confusing.

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:83953] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (8 preceding siblings ...)
  2017-10-03 13:06 ` [ruby-core:83088] " sonots
@ 2017-11-29  7:46 ` mame
  2017-12-11 15:47 ` [ruby-core:84161] " kou
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: mame @ 2017-11-29  7:46 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by mame (Yusuke Endoh).


My enthusiastic -1.

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:84161] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (9 preceding siblings ...)
  2017-11-29  7:46 ` [ruby-core:83953] " mame
@ 2017-12-11 15:47 ` kou
  2017-12-24 15:09 ` [ruby-core:84428] " aeroastro007
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: kou @ 2017-12-11 15:47 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by kou (Kouhei Sutou).


I like this change. It's unbelievable.

I thought that I don't like this feature because I was confused Python's backtrace behavior (most recent call last).

I used trunk in a few weeks but I was not confused the current behavior. Instead it was convenient.

I noticed that I confirm error message and then backtrace on error. It was convenient that error message is shown at the last. I could confirm backtrace from the bottom to the top naturally.

Python's backtrace behavior doesn't show index:

```python
def a():
    x()

def b():
    a()

b()
```

```console
% python /tmp/a.py
Traceback (most recent call last):
  File "/tmp/a.py", line 7, in <module>
    b()
  File "/tmp/a.py", line 5, in b
    a()
  File "/tmp/a.py", line 2, in a
    x()
NameError: global name 'x' is not defined
```

Ruby 2.5's one shows index:

```ruby
def a
  x
end

def b
  a
end

b
```

```console
% ruby /tmp/a.rb
Traceback (most recent call last):
	2: from /tmp/a.rb:9:in `<main>'
	1: from /tmp/a.rb:6:in `b'
/tmp/a.rb:2:in `a': undefined local variable or method `x' for main:Object (NameError)
```

It may be helpful to recognize backtrace order.


I've added the same behavior to test-unit and released a new version.


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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:84428] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (10 preceding siblings ...)
  2017-12-11 15:47 ` [ruby-core:84161] " kou
@ 2017-12-24 15:09 ` aeroastro007
  2018-06-27  3:24 ` [ruby-core:87647] " samuel
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: aeroastro007 @ 2017-12-24 15:09 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by aeroastro (Takumasa Ochi).


Although I am not a Ruby committer, IMHO, I do not think the current implementation
is the best way to fully address the reporter's concern.

As written in this issue's description section, reversing the backtrace is a
solution which only works in the environments where you read the log from bottom
to top like terminals.

Nowadays, it is becoming more and more common to read the log from top to bottom
in other environments like CI report (e.g. Jenkins, Travis, and so on),
web-based error dashboard (e.g. Stack Driver), interactive applications
(e.g. Jupyter). Current Ruby 2.5's behavior is to reverse backtrace when STDERR
is unchanged and a tty. Therefore we can still read the backtrace from top to
bottom in those situations. However, this conditional reversing lacks consistency
and is confusing. For example, just a redirection can change the behavior of output.

At the same time, I think we need to clarify what the problem actually is.
If a lot of people using Rails are suffering from huge backtraces, which can be assumed from
the word "every project" and "tailing the production logs", ActiveSupport::BacktraceCleaner
can solve the problem in a more sophisticated way. It convert the huge backtrace to
a very compact one by filtering out irrelevant lines which belong to Rails framework.
This solution works well regardless of the way how we read the log because the backtrace
is short and simple.

If people developing Rails itself are suffering from huge backtraces, although conditional
reversing could work to some extent, IMHO, we need to consider a solution with fewer
and minor side effects.

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:87647] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (11 preceding siblings ...)
  2017-12-24 15:09 ` [ruby-core:84428] " aeroastro007
@ 2018-06-27  3:24 ` samuel
  2018-08-17 14:41 ` [ruby-core:88515] " mame
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: samuel @ 2018-06-27  3:24 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by ioquatix (Samuel Williams).


This is possibly one of the most irritating changes to Ruby recently. Now, every time I read back trace, I have to check it carefully.

Is it top to bottom or bottom to top?

How is this confusion made worse?

- Using multiple versions of Ruby, or different interpreters that retain the old behaviour.
- Using testing frameworks and logging frameworks that retain the old behaviour.

This is a case where I think the benefit was significantly overshadowed by the cost to end users. It's now very, very confusing.


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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:88515] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (12 preceding siblings ...)
  2018-06-27  3:24 ` [ruby-core:87647] " samuel
@ 2018-08-17 14:41 ` mame
  2018-08-18 17:45 ` [ruby-core:88545] " shevegen
  2019-11-07  4:45 ` [ruby-core:95739] " mame
  15 siblings, 0 replies; 18+ messages in thread
From: mame @ 2018-08-17 14:41 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by mame (Yusuke Endoh).


Over one year has passed since the backtrace order was reversed.  But I'm not still used to the new order.

I agree with Samuel's points.  In addition, the old order was more useful because it shows the last debug output and the exception message in one place.

```
$ ruby24 test.rb
...
...
"debug print"
"debug print"
"the last debug print"
test.rb:X:in 'buggy_func': exception message
	from test.rb:X:in `foo'
	from test.rb:X:in `bar'
...
...
```

In the above output, `"the last debug output"` and `test.rb:X:in 'buggy_func': exception message` are placed in one place.  It is easy to understand the situation and to start debugging.

However, the current behavior separates the two.  This is very frastrating.

```
$ ruby25 test.rb
...
...
"debug print"
"debug print"
"the last debug print"
...
...
	from test.rb:X:in `bar'
	from test.rb:X:in `foo'
test.rb:X:in 'buggy_func': exception message
```

Is there any change to revert the change?

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:88545] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (13 preceding siblings ...)
  2018-08-17 14:41 ` [ruby-core:88515] " mame
@ 2018-08-18 17:45 ` shevegen
  2019-11-07  4:45 ` [ruby-core:95739] " mame
  15 siblings, 0 replies; 18+ messages in thread
From: shevegen @ 2018-08-18 17:45 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by shevegen (Robert A. Heiler).


I think I agree with mame - perhaps it should be reverted for now.

There was another ruby hacker from japan who wrote, some time ago
(a year or two?), that he was confused about it too; I don't remember
where it was but I think it was in a standalone proposal some time
ago.

In my opinion, the best would be to find a way to be able to 
fully customize the behaviour/display that ruby uses for reporting 
warnings/errors, with a default chosen that may be most appropriate
for the most common ways to display the issues at hand (I have no
preference to the default chosen here, but perhaps we should 
revert to the behaviour ruby used to use; and then allow full
customization for people to adapt it to their own personal needs).

I assume that matz may not have a huge preference either, so 
perhaps we should (lateron?) focus on some way to be able to
customize how ruby treats warnings/errors or rather, display
them. An obvious way may be to allow for environment variables.

An additional way may be to pick something at compile time (so
that people can customize it for their own host system, as a 
default), and perhaps also a --user flag directive of some
sorts; and perhaps additionally something like $VERBOSE, but
through some core method call or something instead.

I should, however had, also note that while I think I prefer
the old behaviour, to me personally it is not a huge deal either
way - I just can understand everyone who may not like the
chosen default as-is. The only thing that I personally found hard
was when the filenames are very long and the error is somewhere
deep down in code that gets called by lots of other methods in
different files - then the error messages are "overflowing" to
the right of my screen display, so in this case, I would prefer
a shorter message, or perhaps split up onto several lines; I kind
of focus on the left hand side of my screen normally. But again,
it's not really something I personally am deeply invested - I am
personally am more looking as to how mjit is progressing. :)

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:95739] [CommonRuby Feature#8661] Add option to print backstrace in reverse order(stack frames first & error last)
  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)
                   ` (14 preceding siblings ...)
  2018-08-18 17:45 ` [ruby-core:88545] " shevegen
@ 2019-11-07  4:45 ` mame
  15 siblings, 0 replies; 18+ messages in thread
From: mame @ 2019-11-07  4:45 UTC (permalink / raw)
  To: ruby-core

Issue #8661 has been updated by mame (Yusuke Endoh).


For the record: I am even surprised with myself, but I am not really used to the new order of the backtrace.  I may be too old, but I wish the original backtrace order is back.

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

* 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/

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-11-07  4:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [ruby-core:81299] " shyouhei
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

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).