1. Redirecting ex.err to STDOUT

Hi...

Does Euphoria have a way of redirecting errors to STDERR instead of writing to
ex.err?

Apache has been puking a bunch of "500 pages" because of my newbee syntax
errors. It would be nice if these errors would be redirected to STDOUT or
STDERR - preferably to the screen so that they would be obvious. Any ideas?
TIA....
--
duke

new topic     » topic index » view message » categorize

2. Re: Redirecting ex.err to STDOUT

duke normandin wrote:
> 
> Hi...
> 
> Does Euphoria have a way of redirecting errors to STDERR instead of writing
> to
> ex.err?
> 
> Apache has been puking a bunch of "500 pages" because of my newbee syntax
> errors. It would be nice if these errors would be redirected to STDOUT or
> STDERR - preferably to the screen so that they would be obvious. Any ideas?
> TIA....

You didn't say if you're using Linux or Win32 but you could add these lines to
the top of your code ...

include machine.e
if platform() > 2 then
    -- Linux, Unix
    crash_file("/dev/tty")
else
    -- DOS, Win32
    crash_file("con:")
end if
crash_message(" ** PROGRAM CRASHED **")



-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

3. Re: Redirecting ex.err to STDOUT

Derek Parnell wrote:
> 
> duke normandin wrote:
> > 
> > Hi...
> > 
> > Does Euphoria have a way of redirecting errors to STDERR instead of writing
> > to
> > ex.err?
> > 
> > Apache has been puking a bunch of "500 pages" because of my newbee syntax
> > errors. It would be nice if these errors would be redirected to STDOUT or
> > STDERR - preferably to the screen so that they would be obvious. Any ideas?
> > TIA....
> 
> You didn't say if you're using Linux or Win32 but you could add these lines
> to the top of your code ...
> 
> }}}
<eucode>
> include machine.e
> if platform() > 2 then
>     -- Linux, Unix
>     crash_file("/dev/tty")
> else
>     -- DOS, Win32
>     crash_file("con:")
> end if
> crash_message(" ** PROGRAM CRASHED **")
> </eucode>
{{{

> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

Hey Derek...

I'll be using Euphoria on both FreeBSD and winDoze -- so your code
suggestion is good stuff for a start. However, I want to see the contents
of ex.err on-screen if I put the script in "DEBUG" mode -- something like
Perl / PHP do. Ant thoughts? TIA...
--
duke

new topic     » goto parent     » topic index » view message » categorize

4. Re: Redirecting ex.err to STDOUT

duke normandin wrote:
> I'll be using Euphoria on both FreeBSD and winDoze -- so your code
> suggestion is good stuff for a start. However, I want to see the contents
> of ex.err on-screen if I put the script in "DEBUG" mode -- something like
> Perl / PHP do. Ant thoughts? TIA...

include machine.e
object IsDebugMode
IsDebugMode = getenv("DEBUGMODE")
if equal(IsDebugMode, "on") then
    if platform() > 2 then
        crash_file("/dev/tty")
    else
        crash_file("con:")
    end if
    crash_message(" ** PROGRAM CRASHED ** at ")
end if


Then run the script with 
(windows)
  SET DEBUGMODE=on 

or
(bash)
  DEBUGMODE=on; export DEBUGMODE

to get the messages on screen. Set it 'off' (or don't set it) to get the ex.err
file instead.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

5. Re: Redirecting ex.err to STDOUT

Derek Parnell wrote:
> 
> duke normandin wrote:
> > I'll be using Euphoria on both FreeBSD and winDoze -- so your code
> > suggestion is good stuff for a start. However, I want to see the contents
> > of ex.err on-screen if I put the script in "DEBUG" mode -- something like
> > Perl / PHP do. Ant thoughts? TIA...
> 
> }}}
<eucode>
> include machine.e
> object IsDebugMode
> IsDebugMode = getenv("DEBUGMODE")
> if equal(IsDebugMode, "on") then
>     if platform() > 2 then
>         crash_file("/dev/tty")
>     else
>         crash_file("con:")
>     end if
>     crash_message(" ** PROGRAM CRASHED ** at ")
> end if
> </eucode>
{{{

> 
> Then run the script with 
> (windows)
>   SET DEBUGMODE=on 
> 
> or
> (bash)
>   DEBUGMODE=on; export DEBUGMODE
> 
> to get the messages on screen. Set it 'off' (or don't set it) to get the
> ex.err
> file instead.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

It's after midnight here in Alberta, Canada, and I'm tired as hell,
otherwise I'd be trying out the above code not now, but right now. As it is
it'll have to keep until later. Thanks a lot. Later...
--
duke

new topic     » goto parent     » topic index » view message » categorize

6. Re: Redirecting ex.err to STDOUT

Derek Parnell wrote:
> 
> duke normandin wrote:
> > I'll be using Euphoria on both FreeBSD and winDoze -- so your code
> > suggestion is good stuff for a start. However, I want to see the contents
> > of ex.err on-screen if I put the script in "DEBUG" mode -- something like
> > Perl / PHP do. Ant thoughts? TIA...
> 
> }}}
<eucode>
> include machine.e
> object IsDebugMode
> IsDebugMode = getenv("DEBUGMODE")
> if equal(IsDebugMode, "on") then
>     if platform() > 2 then
>         crash_file("/dev/tty")
>     else
>         crash_file("con:")
>     end if
>     crash_message(" ** PROGRAM CRASHED ** at ")
> end if
> </eucode>
{{{

> 
> Then run the script with 
> (windows)
>   SET DEBUGMODE=on 
> 
> or
> (bash)
>   DEBUGMODE=on; export DEBUGMODE
> 
> to get the messages on screen. Set it 'off' (or don't set it) to get the
> ex.err
> file instead.

Hell I had to try it before going to bed. No joy!. I guess that I mis-spoke.
I want to see the error message on my web browser -- that's what I meant
when I said that I wanted to redirect the errors to the screen. Sorry about
that!
Your code *must* be working because when I check ex.err after a syntax error,
the error is *not* recorded there -- because it's being redirected. Anyway,
I going to get some shut-eye. Later...
--
duke

new topic     » goto parent     » topic index » view message » categorize

7. Re: Redirecting ex.err to STDOUT

duke normandin wrote:
> 
> Hi...
> 
> Does Euphoria have a way of redirecting errors to STDERR instead of writing
> to
> ex.err?
> 
> Apache has been puking a bunch of "500 pages" because of my newbee syntax
> errors. It would be nice if these errors would be redirected to STDOUT or
> STDERR - preferably to the screen so that they would be obvious. Any ideas?
> TIA....

Hi Duke

In addition to what Derek suggested, you might want to look up crash_routine as
well.  I gather you want to send the error messages to the web browser?

In relation to your other question, have a look at our wiki:
http://euwiki.ayo.biz/Can_Euphoria_do_CGI%3F (or from the FAQ section)

Gary

new topic     » goto parent     » topic index » view message » categorize

8. Re: Redirecting ex.err to STDOUT

ags wrote:
> 
> duke normandin wrote:
> > 
> > Hi...
> > 
> > Does Euphoria have a way of redirecting errors to STDERR instead of writing
> > to
> > ex.err?
> > 
> > Apache has been puking a bunch of "500 pages" because of my newbee syntax
> > errors. It would be nice if these errors would be redirected to STDOUT or
> > STDERR - preferably to the screen so that they would be obvious. Any ideas?
> > TIA....
> 
> Hi Duke
> 
> In addition to what Derek suggested, you might want to look up crash_routine
> as well.  I gather you want to send the error messages to the web browser?

That's exactly where i want the error messages sent to. ;)
> 
> In relation to your other question, have a look at our wiki:
> <a
> href="http://euwiki.ayo.biz/Can_Euphoria_do_CGI%3F">http://euwiki.ayo.biz/Can_Euphoria_do_CGI%3F</a>
> (or from the FAQ section)

Thanks!
--
duke

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu