Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Obsoleted QgsMSLogger as it duplicates functionality from QgsLogger
  • Loading branch information
timlinux committed Jun 10, 2011
1 parent 2fe16b5 commit d967b71
Show file tree
Hide file tree
Showing 21 changed files with 231 additions and 369 deletions.
1 change: 0 additions & 1 deletion src/mapserver/CMakeLists.txt
Expand Up @@ -29,7 +29,6 @@ SET ( qgis_mapserv_SRCS
qgssldrenderer.cpp
qgswmsserver.cpp
qgsmapserviceexception.cpp
qgsmapserverlogger.cpp
qgsmslayercache.cpp
qgsfilter.cpp
qgssldrule.cpp
Expand Down
66 changes: 31 additions & 35 deletions src/mapserver/qgis_map_serv.cpp
Expand Up @@ -23,7 +23,7 @@ map service syntax for SOAP/HTTP POST
#include "qgsgetrequesthandler.h"
#include "qgssoaprequesthandler.h"
#include "qgsproviderregistry.h"
#include "qgsmapserverlogger.h"
#include "qgslogger.h"
#include "qgswmsserver.h"
#include "qgsmaprenderer.h"
#include "qgsmapserviceexception.h"
Expand Down Expand Up @@ -62,7 +62,7 @@ void dummyMessageHandler( QtMsgType type, const char *msg )

output += msg;

QgsMapServerLogger::instance()->printMessage( output );
QgsDebugMsg( output );

if ( type == QtFatalMsg )
abort();
Expand All @@ -73,44 +73,44 @@ void printRequestInfos()
{
#ifdef QGSMSDEBUG
//print out some infos about the request
QgsMSDebugMsg( "************************new request**********************" );
QgsMSDebugMsg( QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) );
QgsDebugMsg( "************************new request**********************" );
QgsDebugMsg( QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) );

if ( getenv( "REMOTE_ADDR" ) != NULL )
{
QgsMSDebugMsg( "remote ip: " + QString( getenv( "REMOTE_ADDR" ) ) );
QgsDebugMsg( "remote ip: " + QString( getenv( "REMOTE_ADDR" ) ) );
}
if ( getenv( "REMOTE_HOST" ) != NULL )
{
QgsMSDebugMsg( "remote host: " + QString( getenv( "REMOTE_HOST" ) ) );
QgsDebugMsg( "remote host: " + QString( getenv( "REMOTE_HOST" ) ) );
}
if ( getenv( "REMOTE_USER" ) != NULL )
{
QgsMSDebugMsg( "remote user: " + QString( getenv( "REMOTE_USER" ) ) );
QgsDebugMsg( "remote user: " + QString( getenv( "REMOTE_USER" ) ) );
}
if ( getenv( "REMOTE_IDENT" ) != NULL )
{
QgsMSDebugMsg( "REMOTE_IDENT: " + QString( getenv( "REMOTE_IDENT" ) ) );
QgsDebugMsg( "REMOTE_IDENT: " + QString( getenv( "REMOTE_IDENT" ) ) );
}
if ( getenv( "CONTENT_TYPE" ) != NULL )
{
QgsMSDebugMsg( "CONTENT_TYPE: " + QString( getenv( "CONTENT_TYPE" ) ) );
QgsDebugMsg( "CONTENT_TYPE: " + QString( getenv( "CONTENT_TYPE" ) ) );
}
if ( getenv( "AUTH_TYPE" ) != NULL )
{
QgsMSDebugMsg( "AUTH_TYPE: " + QString( getenv( "AUTH_TYPE" ) ) );
QgsDebugMsg( "AUTH_TYPE: " + QString( getenv( "AUTH_TYPE" ) ) );
}
if ( getenv( "HTTP_USER_AGENT" ) != NULL )
{
QgsMSDebugMsg( "HTTP_USER_AGENT: " + QString( getenv( "HTTP_USER_AGENT" ) ) );
QgsDebugMsg( "HTTP_USER_AGENT: " + QString( getenv( "HTTP_USER_AGENT" ) ) );
}
#endif //QGSMSDEBUG
}

QFileInfo defaultProjectFile()
{
QDir currentDir;
QgsMSDebugMsg( "current directory: " + currentDir.absolutePath() );
QgsDebugMsg( "current directory: " + currentDir.absolutePath() );
fprintf( FCGI_stderr, "current directory: %s\n", currentDir.absolutePath().toUtf8().constData() );
QStringList nameFilterList;
nameFilterList << "*.qgs";
Expand Down Expand Up @@ -163,16 +163,12 @@ int main( int argc, char * argv[] )

// Instantiate the plugin directory so that providers are loaded
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
#if defined(QGSMSDEBUG) && !defined(_MSC_VER)
//write to qgis_wms_server.log in application directory
QgsMapServerLogger::instance()->setLogFilePath( qgsapp.applicationDirPath() + "/qgis_wms_server.log" );
#endif
QgsMSDebugMsg( "Prefix PATH: " + QgsApplication::prefixPath() );
QgsMSDebugMsg( "Plugin PATH: " + QgsApplication::pluginPath() );
QgsMSDebugMsg( "PkgData PATH: " + QgsApplication::pkgDataPath() );
QgsMSDebugMsg( "User DB PATH: " + QgsApplication::qgisUserDbFilePath() );
QgsDebugMsg( "Prefix PATH: " + QgsApplication::prefixPath() );
QgsDebugMsg( "Plugin PATH: " + QgsApplication::pluginPath() );
QgsDebugMsg( "PkgData PATH: " + QgsApplication::pkgDataPath() );
QgsDebugMsg( "User DB PATH: " + QgsApplication::qgisUserDbFilePath() );

QgsMSDebugMsg( qgsapp.applicationDirPath() + "/qgis_wms_server.log" );
QgsDebugMsg( qgsapp.applicationDirPath() + "/qgis_wms_server.log" );

//create config cache and search for config files in the current directory.
//These configurations are used if no mapfile parameter is present in the request
Expand Down Expand Up @@ -208,18 +204,18 @@ int main( int argc, char * argv[] )
{
if ( strcmp( requestMethod, "POST" ) == 0 )
{
QgsMSDebugMsg( "Creating QgsSOAPRequestHandler" );
QgsDebugMsg( "Creating QgsSOAPRequestHandler" );
theRequestHandler = new QgsSOAPRequestHandler();
}
else
{
QgsMSDebugMsg( "Creating QgsGetRequestHandler" );
QgsDebugMsg( "Creating QgsGetRequestHandler" );
theRequestHandler = new QgsGetRequestHandler();
}
}
else
{
QgsMSDebugMsg( "Creating QgsGetRequestHandler" );
QgsDebugMsg( "Creating QgsGetRequestHandler" );
theRequestHandler = new QgsGetRequestHandler();
}

Expand All @@ -231,7 +227,7 @@ int main( int argc, char * argv[] )
}
catch ( QgsMapServiceException& e )
{
QgsMSDebugMsg( "An exception was thrown during input parsing" );
QgsDebugMsg( "An exception was thrown during input parsing" );
theRequestHandler->sendServiceException( e );
continue;
}
Expand All @@ -247,7 +243,7 @@ int main( int argc, char * argv[] )
QgsConfigParser* adminConfigParser = QgsConfigCache::instance()->searchConfiguration( configFilePath );
if ( !adminConfigParser )
{
QgsMSDebugMsg( "parse error on config file " + configFilePath );
QgsDebugMsg( "parse error on config file " + configFilePath );
theRequestHandler->sendServiceException( QgsMapServiceException( "", "Configuration file problem : perhaps you left off the .qgs extension?" ) );
continue;
}
Expand All @@ -260,7 +256,7 @@ int main( int argc, char * argv[] )
if ( serviceIt == parameterMap.end() )
{
//tell the user that service parameter is mandatory
QgsMSDebugMsg( "unable to find 'SERVICE' parameter, exiting..." );
QgsDebugMsg( "unable to find 'SERVICE' parameter, exiting..." );
theRequestHandler->sendServiceException( QgsMapServiceException( "ServiceNotSpecified", "Service not specified. The SERVICE parameter is mandatory" ) );
delete theRequestHandler;
continue;
Expand All @@ -285,7 +281,7 @@ int main( int argc, char * argv[] )
if ( requestIt == parameterMap.end() )
{
//do some error handling
QgsMSDebugMsg( "unable to find 'REQUEST' parameter, exiting..." );
QgsDebugMsg( "unable to find 'REQUEST' parameter, exiting..." );
theRequestHandler->sendServiceException( QgsMapServiceException( "OperationNotSupported", "Please check the value of the REQUEST parameter" ) );
delete theRequestHandler;
delete theServer;
Expand All @@ -297,7 +293,7 @@ int main( int argc, char * argv[] )
const QDomDocument* capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath );
if ( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
{
QgsMSDebugMsg( "Capabilities document not found in cache" );
QgsDebugMsg( "Capabilities document not found in cache" );
QDomDocument doc;
try
{
Expand All @@ -315,7 +311,7 @@ int main( int argc, char * argv[] )
}
else
{
QgsMSDebugMsg( "Found capabilities document in cache" );
QgsDebugMsg( "Found capabilities document in cache" );
}

if ( capabilitiesDocument )
Expand All @@ -335,7 +331,7 @@ int main( int argc, char * argv[] )
}
catch ( QgsMapServiceException& ex )
{
QgsMSDebugMsg( "Catched exception during GetMap request" );
QgsDebugMsg( "Catched exception during GetMap request" );
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
Expand All @@ -344,13 +340,13 @@ int main( int argc, char * argv[] )

if ( result )
{
QgsMSDebugMsg( "Sending GetMap response" );
QgsDebugMsg( "Sending GetMap response" );
theRequestHandler->sendGetMapResponse( serviceIt->second, result );
}
else
{
//do some error handling
QgsMSDebugMsg( "result image is 0" );
QgsDebugMsg( "result image is 0" );
}
delete result;
delete theRequestHandler;
Expand Down Expand Up @@ -420,14 +416,14 @@ int main( int argc, char * argv[] )

if ( result )
{
QgsMSDebugMsg( "Sending GetLegendGraphics response" );
QgsDebugMsg( "Sending GetLegendGraphics response" );
//sending is the same for GetMap and GetLegendGraphics
theRequestHandler->sendGetMapResponse( serviceIt->second, result );
}
else
{
//do some error handling
QgsMSDebugMsg( "result image is 0" );
QgsDebugMsg( "result image is 0" );
}
delete result;
delete theRequestHandler;
Expand Down
4 changes: 2 additions & 2 deletions src/mapserver/qgscapabilitiescache.cpp
Expand Up @@ -16,7 +16,7 @@
***************************************************************************/

#include "qgscapabilitiescache.h"
#include "qgsmapserverlogger.h"
#include "qgslogger.h"
#include <QCoreApplication>

QgsCapabilitiesCache::QgsCapabilitiesCache()
Expand Down Expand Up @@ -57,7 +57,7 @@ void QgsCapabilitiesCache::insertCapabilitiesDocument( const QString& configFile

void QgsCapabilitiesCache::removeChangedEntry( const QString& path )
{
QgsMSDebugMsg( "Remove capabilities cache entry because file changed" );
QgsDebugMsg( "Remove capabilities cache entry because file changed" );
QHash< QString, QDomDocument >::iterator it = mCachedCapabilities.find( path );
if ( it != mCachedCapabilities.end() )
{
Expand Down
14 changes: 7 additions & 7 deletions src/mapserver/qgsconfigcache.cpp
Expand Up @@ -16,7 +16,7 @@
***************************************************************************/

#include "qgsconfigcache.h"
#include "qgsmapserverlogger.h"
#include "qgslogger.h"
#include "qgsmslayercache.h"
#include "qgsprojectparser.h"
#include "qgssldparser.h"
Expand Down Expand Up @@ -54,12 +54,12 @@ QgsConfigParser* QgsConfigCache::searchConfiguration( const QString& filePath )
QHash<QString, QgsConfigParser*>::const_iterator configIt = mCachedConfigurations.find( filePath );
if ( configIt == mCachedConfigurations.constEnd() )
{
QgsMSDebugMsg( "Create new configuration" );
QgsDebugMsg( "Create new configuration" );
p = insertConfiguration( filePath );
}
else
{
QgsMSDebugMsg( "Return configuration from cache" );
QgsDebugMsg( "Return configuration from cache" );
p = configIt.value();
}

Expand Down Expand Up @@ -89,7 +89,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
QFile* configFile = new QFile( filePath );
if ( !configFile->exists() || !configFile->open( QIODevice::ReadOnly ) )
{
QgsMSDebugMsg( "File unreadable: " + filePath );
QgsDebugMsg( "File unreadable: " + filePath );
delete configFile;
return 0;
}
Expand All @@ -100,7 +100,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
int line, column;
if ( !configDoc->setContent( configFile, true, &errorMsg, &line, &column ) )
{
QgsMSDebugMsg( QString( "Parse error %1 at row %2, column %3 in %4 " )
QgsDebugMsg( QString( "Parse error %1 at row %2, column %3 in %4 " )
.arg( errorMsg ).arg( line ).arg( column ).arg( filePath ) );
delete configFile;
delete configDoc;
Expand All @@ -120,7 +120,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
}
else
{
QgsMSDebugMsg( "SLD or qgis expected in " + filePath );
QgsDebugMsg( "SLD or qgis expected in " + filePath );
delete configDoc;
return 0;
}
Expand All @@ -133,7 +133,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )

void QgsConfigCache::removeChangedEntry( const QString& path )
{
QgsMSDebugMsg( "Remove config cache entry because file changed" );
QgsDebugMsg( "Remove config cache entry because file changed" );
QHash<QString, QgsConfigParser*>::iterator configIt = mCachedConfigurations.find( path );
if ( configIt != mCachedConfigurations.end() )
{
Expand Down
12 changes: 6 additions & 6 deletions src/mapserver/qgsgetrequesthandler.cpp
@@ -1,6 +1,6 @@
#include "qgsgetrequesthandler.h"
#include "qgsftptransaction.h"
#include "qgsmapserverlogger.h"
#include "qgslogger.h"
#include "qgsmapserviceexception.h"
#include "qgsremotedatasourcebuilder.h"
#include "qgshttptransaction.h"
Expand All @@ -24,11 +24,11 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()
if ( qs )
{
queryString = QString( qs );
QgsMSDebugMsg( "query string is: " + queryString );
QgsDebugMsg( "query string is: " + queryString );
}
else
{
QgsMSDebugMsg( "error, no query string found" );
QgsDebugMsg( "error, no query string found" );
return parameters; //no query string? something must be wrong...
}

Expand Down Expand Up @@ -84,7 +84,7 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()

}
parameters.insert( std::make_pair( key.toUpper(), value ) );
QgsMSDebugMsg( "inserting pair " + key.toUpper() + " // " + value + " into the parameter map" );
QgsDebugMsg( "inserting pair " + key.toUpper() + " // " + value + " into the parameter map" );
}

//feature info format?
Expand All @@ -100,7 +100,7 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()
{
QString formatString = formatIt->second;

QgsMapServerLogger::instance()->printMessage( "formatString is: " + formatString );
QgsDebugMsg( QString( "formatString is: %1" ).arg( formatString ) );

//remove the image/ in front of the format
if ( formatString.compare( "image/png", Qt::CaseInsensitive ) == 0 || formatString.compare( "png", Qt::CaseInsensitive ) == 0 )
Expand Down Expand Up @@ -164,7 +164,7 @@ void QgsGetRequestHandler::sendGetStyleResponse( const QDomDocument& doc ) const
void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) const
{
QByteArray ba;
QgsMSDebugMsg( "Info format is:" + infoFormat );
QgsDebugMsg( "Info format is:" + infoFormat );

if ( infoFormat == "text/xml" )
{
Expand Down
10 changes: 5 additions & 5 deletions src/mapserver/qgshostedrdsbuilder.cpp
Expand Up @@ -17,7 +17,7 @@
***************************************************************************/

#include "qgshostedrdsbuilder.h"
#include "qgsmapserverlogger.h"
#include "qgslogger.h"
#include "qgsmslayercache.h"
#include "qgsrasterlayer.h"
#include "qgscoordinatereferencesystem.h"
Expand All @@ -35,7 +35,7 @@ QgsHostedRDSBuilder::~QgsHostedRDSBuilder()

QgsMapLayer* QgsHostedRDSBuilder::createMapLayer( const QDomElement& elem, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "entering." );
QgsDebugMsg( "entering." );

if ( elem.isNull() )
{
Expand All @@ -45,20 +45,20 @@ QgsMapLayer* QgsHostedRDSBuilder::createMapLayer( const QDomElement& elem, const
QString uri = elem.attribute( "uri", "not found" );
if ( uri == "not found" )
{
QgsMSDebugMsg( "Uri not found" );
QgsDebugMsg( "Uri not found" );
return 0;
}
else
{
QgsMSDebugMsg( "Trying to get hostedrds layer from cache with uri: " + uri );
QgsDebugMsg( "Trying to get hostedrds layer from cache with uri: " + uri );
QgsRasterLayer* rl = 0;
if ( allowCaching )
{
rl = dynamic_cast<QgsRasterLayer*>( QgsMSLayerCache::instance()->searchLayer( uri, layerName ) );
}
if ( !rl )
{
QgsMSDebugMsg( "hostedrds layer not in cache, so create and insert it" );
QgsDebugMsg( "hostedrds layer not in cache, so create and insert it" );
rl = new QgsRasterLayer( uri, layerNameFromUri( uri ) );
if ( allowCaching )
{
Expand Down

0 comments on commit d967b71

Please sign in to comment.