Skip to content

Commit a5d2844

Browse files
committedDec 6, 2011
Added more debugging info to wms server. Also when compiled in debug mode, it will write the last rendered image out to the system temp dir (overwriting it with each render)
1 parent 6ddf1f6 commit a5d2844

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed
 

‎src/mapserver/qgis_map_serv.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ int main( int argc, char * argv[] )
346346
}
347347
catch ( QgsMapServiceException& ex )
348348
{
349-
QgsDebugMsg( "Catched exception during GetMap request" );
349+
QgsDebugMsg( "Caught exception during GetMap request" );
350350
theRequestHandler->sendServiceException( ex );
351351
delete theRequestHandler;
352352
delete theServer;
@@ -357,6 +357,7 @@ int main( int argc, char * argv[] )
357357
{
358358
QgsDebugMsg( "Sending GetMap response" );
359359
theRequestHandler->sendGetMapResponse( serviceString, result );
360+
QgsDebugMsg( "Response sent" );
360361
}
361362
else
362363
{
@@ -477,6 +478,7 @@ int main( int argc, char * argv[] )
477478
}
478479

479480
delete theMapRenderer;
481+
QgsDebugMsg( "************* all done ***************" );
480482
return 0;
481483
}
482484

‎src/mapserver/qgshttprequesthandler.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <QStringList>
3030
#include <QUrl>
3131
#include <fcgi_stdio.h>
32+
#include "qgslogger.h"
3233

3334
QgsHttpRequestHandler::QgsHttpRequestHandler(): QgsRequestHandler()
3435
{
@@ -42,6 +43,7 @@ QgsHttpRequestHandler::~QgsHttpRequestHandler()
4243

4344
void QgsHttpRequestHandler::sendHttpResponse( QByteArray* ba, const QString& format ) const
4445
{
46+
QgsDebugMsg("Checking byte array is ok to send...");
4547
if ( !ba )
4648
{
4749
return;
@@ -52,12 +54,16 @@ void QgsHttpRequestHandler::sendHttpResponse( QByteArray* ba, const QString& for
5254
return;
5355
}
5456

57+
QgsDebugMsg("Byte array looks good, returning response...");
58+
QgsDebugMsg(QString("Content size: %1").arg(ba->size()));
59+
QgsDebugMsg(QString("Content format: %1").arg(format));
5560
printf( "Content-Type: " );
5661
printf( format.toLocal8Bit() );
5762
printf( "\n" );
5863
printf( "Content-Length: %d\n", ba->size() );
5964
printf( "\n" );
60-
fwrite( ba->data(), ba->size(), 1, FCGI_stdout );
65+
int result=fwrite( ba->data(), ba->size(), 1, FCGI_stdout );
66+
QgsDebugMsg(QString("Sent %1 bytes").arg(result));
6167
}
6268

6369
QString QgsHttpRequestHandler::formatToMimeType( const QString& format ) const
@@ -84,10 +90,12 @@ QString QgsHttpRequestHandler::formatToMimeType( const QString& format ) const
8490
void QgsHttpRequestHandler::sendGetMapResponse( const QString& service, QImage* img ) const
8591
{
8692
Q_UNUSED( service );
93+
QgsDebugMsg("Sending getmap response...");
8794
if ( img )
8895
{
8996
if ( mFormat != "PNG" && mFormat != "JPG" )
9097
{
98+
QgsDebugMsg("service exception - incorrect image format requested...");
9199
sendServiceException( QgsMapServiceException( "InvalidFormat", "Output format '" + mFormat + "' is not supported in the GetMap request" ) );
92100
return;
93101
}

‎src/mapserver/qgswmsserver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,12 @@ QImage* QgsWMSServer::getMap()
581581
restoreLayerFilters( originalLayerFilters );
582582
clearFeatureSelections( selectedLayerIdList );
583583

584+
QgsDebugMsg("clearing filters");
584585
QgsMapLayerRegistry::instance()->mapLayers().clear();
586+
587+
#ifdef QGISDEBUG
588+
theImage->save( QDir::tempPath() + QDir::separator() + "lastrender.png" );
589+
#endif
585590
return theImage;
586591
}
587592

0 commit comments

Comments
 (0)
Please sign in to comment.