Skip to content

Commit

Permalink
Write entry to server log if a datasource/map/print composition is no…
Browse files Browse the repository at this point in the history
…t valid
  • Loading branch information
mhugent committed Jan 19, 2019
1 parent 575d385 commit abd6297
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/server/qgsconfigcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const QgsProject *QgsConfigCache::project( const QString &path )
{
if ( badLayerHandler->badLayers().size() > 0 )
{
QString errorMsg = QString( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) );
}
mProjectCache.insert( path, prj.release() );
Expand Down
2 changes: 1 addition & 1 deletion src/server/qgsfcgiserverrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ QgsFcgiServerRequest::QgsFcgiServerRequest()
}

// Store the URL before the server rewrite that could have been set in QUERY_STRING
//mOriginalUrl = url;
mOriginalUrl = url;

// OGC parameters are passed with the query string, which is normally part of
// the REQUEST_URI, we override the query string url in case it is defined
Expand Down
12 changes: 11 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2930,11 +2930,16 @@ namespace QgsWms
if ( !renderJob.errors().isEmpty() )
{
QString layerWMSName;
QgsMapLayer *errorLayer = mProject->mapLayer( renderJob.errors().at( 0 ).layerID );
QString firstErrorLayerId = renderJob.errors().at( 0 ).layerID;
QgsMapLayer *errorLayer = mProject->mapLayer( firstErrorLayerId );
if ( errorLayer )
{
layerWMSName = layerNickname( *errorLayer );
}

//Log first error
QString errorMsg = QString( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );
throw QgsServerException( QString( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
}
}
Expand Down Expand Up @@ -3274,6 +3279,11 @@ namespace QgsWms
{
if ( !( *mapIt )->renderingErrors().isEmpty() )
{
//Log first error
QgsMapRendererJob::Error e = ( *mapIt )->renderingErrors().at( 0 );
QString errorMsg = QString( "Rendering error : '%1' in layer %2" ).arg( e.message ).arg( e.layerID );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );

throw QgsServerException( QStringLiteral( "Print error" ) );
}
}
Expand Down

0 comments on commit abd6297

Please sign in to comment.