diff --git a/Modules/Core/Common/include/otbLogger.h b/Modules/Core/Common/include/otbLogger.h index 7325a9adcdfdcab7231522e77b5f184a183c7e79..f4814d1fd7b2f62411e48509d19191a9fca8a933 100644 --- a/Modules/Core/Common/include/otbLogger.h +++ b/Modules/Core/Common/include/otbLogger.h @@ -50,6 +50,8 @@ public: // Overwrite this to provide custom formatting of log entries virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE; + void LogSetupInformation(); + protected: itkNewMacro(Self); Logger(); diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt index 50e410e9c8ee5113c51c26e604736e45f69e44e8..ce5d20761e59a5e57cf7f3b909317dc1c072f7aa 100644 --- a/Modules/Core/Common/src/CMakeLists.txt +++ b/Modules/Core/Common/src/CMakeLists.txt @@ -34,8 +34,7 @@ set(OTBCommon_SRC add_library(OTBCommon ${OTBCommon_SRC}) target_link_libraries(OTBCommon - ${OTBITK_LIBRARIES} - + ${OTBITK_LIBRARIES} ${OTBGDAL_LIBRARIES} ) otb_module_target(OTBCommon) diff --git a/Modules/Core/Common/src/otbLogger.cxx b/Modules/Core/Common/src/otbLogger.cxx index 0ed6b6f790631822e5c26a9afd3214f572897b3d..1dd9303f2631a1d7c6f9911f6b5e12ff6ef19ebc 100644 --- a/Modules/Core/Common/src/otbLogger.cxx +++ b/Modules/Core/Common/src/otbLogger.cxx @@ -23,6 +23,8 @@ #include "otbConfigurationManager.h" #include "itkStdStreamLogOutput.h" #include <iostream> +#include "gdal.h" +#include "itkMultiThreader.h" namespace otb { @@ -40,12 +42,14 @@ Logger::Pointer Logger::Instance() defaultOutput->SetStream(std::cout); Logger::Singleton->AddLogOutput(defaultOutput); + + // Log setup information + Logger::Singleton->LogSetupInformation(); } return Logger::Singleton; } - Logger::Logger() { this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel()); @@ -60,6 +64,23 @@ Logger::~Logger() { } +void Logger::LogSetupInformation() +{ + std::ostringstream oss; + + oss<<"Default RAM limit for OTB is "<<otb::ConfigurationManager::GetMaxRAMHint()<<" Mb"<<std::endl; + this->Info(oss.str()); + oss.str(""); + + oss<<"Gdal maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" Mb"<<std::endl; + this->Info(oss.str()); + oss.str(""); + + oss<<"OTB will use at most "<<itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<" threads"<<std::endl; + this->Info(oss.str()); + oss.str(""); +} + std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content) { static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)",