Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Get the Pretty view use STDERR in error_log file

by gopalr (Priest)
on Jul 07, 2006 at 09:41 UTC ( [id://559752]=perlquestion: print w/replies, xml ) Need Help??

gopalr has asked for the wisdom of the Perl Monks concerning the following question:

Great Monks,

When I try to debug the CGI Code using the below code, I get unclear output in error_log file.

Code

my @arr=qw(Apple Banana Orange Flower Green Red Yellow); print STDERR @arr;

Unclear output found in error_log file

[Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Apple, referer +: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Banana, refere +r: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Orange, refere +r: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Flower, refere +r: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Green, referer +: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Red, referer: +http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3 [Fri Jul 07 15:02:20 2006] [error] [client 10.50.11.85] Yellow, refere +r: http://10.50.11.85/cgi-bin/mvc/GoView.cgi?rm=mode3

Can you guide me how to get pretty view.

Thanks,
Gopal R.

Replies are listed 'Best First'.
Re: Get the Pretty view use STDERR in error_log file
by davorg (Chancellor) on Jul 07, 2006 at 10:52 UTC

    Have you tried printing a string rather than a list?

    print STDERR "@arr";
    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Get the Pretty view use STDERR in error_log file
by arkturuz (Curate) on Jul 07, 2006 at 10:15 UTC
    Can you clarify the term "pretty view"? I find your log pretty informative.
    If you're using Apache web server you can customize log output with LogFormat directive.
      If you're using Apache web server you can customize log output with LogFormat directive.

      You can modify the access log with LogFormat. You cannot modify the error log.

      From http://httpd.apache.org/docs/2.0/logs.html#errorlog :

      It is not possible to customize the error log by adding or removing information. However, error log entries dealing with particular requests have corresponding entries in the access log. For instance, the above example entry corresponds to an access log entry with status code 403. Since it is possible to customize the access log, you can obtain more information about error conditions using that log file.
        /me bows humble before the master :-)
        I admit, OPs question confused me, so I was rather too quick to answer.

      Hi arkturuz,

      Pretty view like "Apple Banana Orange Flower Green Red Yellow" in Single line.

      I am using Apache Web Server.

        print STDERR join(' ',@arr)
        should make it appear in one line in the Apache error log.

        --Solo

        --
        You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
Re: Get the Pretty view use STDERR in error_log file
by jbisbee (Pilgrim) on Jul 07, 2006 at 10:43 UTC
    Try Data::Dumper
    use Data::Dumper; my @arr=qw(Apple Banana Orange Flower Green Red Yellow); print STDERR Dumper [ @arr ];
    gives you
    $VAR1 = [ 'Apple', 'Banana', 'Orange', 'Flower', 'Green', 'Red', 'Yellow' ];

    -biz-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://559752]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-18 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found