Practical mod_perl / HTML Book /



previous page: 20.1.3. Configuring Apache::DBI
  
page up: HTML Version of the book
  
next page: 20.1.5. Caveats and Troubleshooting

20.1.4. Debugging Apache::DBI


If you are not sure whether this module is working as advertised and that your connections are actually persistent, you should enable debug mode in the startup.pl script, like this:

$Apache::DBI::DEBUG = 1;

Starting with Apache::DBI Version 0.84, the above setting will produce only minimal output. For a full trace, you should set:

$Apache::DBI::DEBUG = 2;

After setting the DEBUG level, you will see entries in the error_log file. Here is a sample of the output with a DEBUG level of 1:

12851 Apache::DBI new connect to
'test::localhostPrintError=1RaiseError=0AutoCommit=1'

12853 Apache::DBI new connect to
'test::localhostPrintError=1RaiseError=0AutoCommit=1'

When a connection is reused, Apache::DBIstays silent, so you can see when a real connect( ) is called. If you set the DEBUG level to 2, you'll see a more verbose output. This output was generated after two identical requests with a single server running:

12885 Apache::DBI need ping: yes
12885 Apache::DBI new connect to
'test::localhostPrintError=1RaiseError=0AutoCommit=1'
12885 Apache::DBI need ping: yes
12885 Apache::DBI already connected to
'test::localhostPrintError=1RaiseError=0AutoCommit=1'

You can see that process 12885 created a new connection on the first request and on the next request reused it, since it was using the same connect( ) argument. Moreover, you can see that the connection was validated each time with the ping( ) method.

 

Continue to:

  • prev: 20.1.3. Configuring Apache::DBI
  • Table of Contents
  • next: 20.1.5. Caveats and Troubleshooting







TOP
previous page: 20.1.3. Configuring Apache::DBI
  
page up: HTML Version of the book
  
next page: 20.1.5. Caveats and Troubleshooting


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com