Re: Printing for debugging

2008-01-14 Thread Colin Wetherbee

Raful Mr Mitchell H wrote:
I have my code pasted below.  My module, loaded with Location 
directive in Apache2, works well.  However, sometimes switches don't 
respond correctly to bulk queries of fdbPorts object.  What I want to do 
is to be able print the value of my variables either to the browser or a 
log file.  A regular print statement does not work for this.  The 
relevant variables are in a subroutine called from my sub handler.


I'm not entirely sure where, in those lines of unindented HTML, you're 
trying to perform your logging.  The only thing I could find quickly was 
the following code, but I can't be certain that's the subject of your 
question.


if( $arp_session-{ErrorNum} ){ print Got $arp_session-{ErrorStr} for 
$router\n; }


In order to print log messages to Apache's (or your virtual host's) 
error log, you can use the following.


use Apache2::RequestUtil;
use Apache2::Log;

Apache2::RequestUtil-request-log-error('some_text');

Substituting other log levels (debug, info, warn, etc.) works, as well. 
 See the following URL for more information.


http://perl.apache.org/docs/2.0/api/Apache2/Log.html#LogLevel_Methods

If this isn't what you're seeking, perhaps you could include a more 
concise test case and a more elaborate explanation in your next post?


Colin



RE: Printing for debugging

2008-01-14 Thread Raful Mr Mitchell H
Thanks!  Using the Apache2::RequestUtil and Apache2::Log, I can find out what 
my variables' values are to debug and check my code.

Mitch



Mitchell Raful MCSE CCNP
MCB Quantico
Personal and Family Readiness (MRI)
3044 Catlin Avenue
Quantico, VA 22134
Com: 703-784-5991
DSN: 278-5991
Cell: 804-363-0731


-Original Message-
From: Colin Wetherbee [mailto:[EMAIL PROTECTED]
Sent: Monday, January 14, 2008 11:08 AM
To: Raful Mr Mitchell H
Cc: Modperl (E-mail)
Subject: Re: Printing for debugging


Raful Mr Mitchell H wrote:
 I have my code pasted below.  My module, loaded with Location 
 directive in Apache2, works well.  However, sometimes switches don't 
 respond correctly to bulk queries of fdbPorts object.  What I want to do 
 is to be able print the value of my variables either to the browser or a 
 log file.  A regular print statement does not work for this.  The 
 relevant variables are in a subroutine called from my sub handler.

I'm not entirely sure where, in those lines of unindented HTML, you're 
trying to perform your logging.  The only thing I could find quickly was 
the following code, but I can't be certain that's the subject of your 
question.

if( $arp_session-{ErrorNum} ){ print Got $arp_session-{ErrorStr} for 
$router\n; }

In order to print log messages to Apache's (or your virtual host's) 
error log, you can use the following.

use Apache2::RequestUtil;
use Apache2::Log;

Apache2::RequestUtil-request-log-error('some_text');

Substituting other log levels (debug, info, warn, etc.) works, as well. 
  See the following URL for more information.

http://perl.apache.org/docs/2.0/api/Apache2/Log.html#LogLevel_Methods

If this isn't what you're seeking, perhaps you could include a more 
concise test case and a more elaborate explanation in your next post?

Colin