How do I send errors and exceptions to the main output?

1

I'm using Ruby 2.1 32 bit. Interpreting scripts as CGI by Apache 2. Through Local IP.

I'm in a process of migrating multiple scripts in PHP to Ruby.

During the process of writing code, several times error both in typing and some new concepts about the language and its various libraries. The problem is that every time an error or exception happens, Apache just returns Error 500. And for that, I have to open the Apache error logs to check for the confusing messages, which takes me coding time.

My question, is there any way to send the errors and exceptions to the default output so that they are shown in the Browser and not only recognized by the server?

    
asked by anonymous 23.04.2015 / 17:37

1 answer

2

The simplest solution is to set global error output as the default output at the beginning of your script:

$stderr = STDOUT

STDOUT is the IO object that represents the default output.

    
27.04.2015 / 21:36