diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h index bda9f966a7c6c711f6e88f30fb39ae98c5adb08e..a03863097527c48aba4556f8fcbb962d920c2ee2 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h @@ -265,9 +265,6 @@ namespace Mantid /// the POCO system Config Object WrappedObject<Poco::Util::SystemConfiguration>* m_pSysConfig; - /// reference to the logger class - Logger& g_log; - /// A set of property keys that have been changed mutable std::set<std::string> m_changed_keys; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DataService.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DataService.h index b58a09d224dfeb919d678896eb980ac149465582..2bdf31648f1ef4ecb8d94d3ac0250c5e8b3647a3 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DataService.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DataService.h @@ -464,7 +464,7 @@ public: protected: /// Protected constructor (singleton) - DataService(const std::string& name) : svc_name(name),g_log(Kernel::Logger::get(svc_name)) {} + DataService(const std::string& name) : svc_name(name),g_log(svc_name) {} virtual ~DataService(){} private: @@ -537,8 +537,8 @@ private: svcmap datamap; /// Recursive mutex to avoid simultaneous access or notifications mutable Poco::Mutex m_mutex; - /// Reference to the logger for this DataService - Logger& g_log; + /// Logger for this DataService + Logger g_log; }; // End Class Data service } // Namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DateAndTime.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DateAndTime.h index 294f8a5d23763e08ef4feab12dbc0419d3cb8a7b..290f713deb484d660e6355be6abc0ed3a7a8f627 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DateAndTime.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DateAndTime.h @@ -13,9 +13,6 @@ namespace Kernel /// Durations and time intervals typedef boost::posix_time::time_duration time_duration; -// forward declaration -class Logger; - //============================================================================================= /** Class for holding the date and time in Mantid. * It is stored as a signed 64-bit int of the # of nanoseconds since Jan 1, 1990. @@ -113,9 +110,6 @@ public: private: ///A signed 64-bit int of the # of nanoseconds since Jan 1, 1990. int64_t _nanoseconds; - - /// A reference to the logger - static Logger & g_log; }; #pragma pack(pop) diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DirectoryValidator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DirectoryValidator.h index bdb8d02d0c31201f1430cd6004be075e395d59b9..d16ff94d82222aea032ed5378818500c08b7c176 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DirectoryValidator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DirectoryValidator.h @@ -49,9 +49,6 @@ public: private: virtual std::string checkValidity(const std::string &value) const; - - /// A reference to the logger - static Logger & g_log; }; } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DllOpen.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DllOpen.h index 21848f176836838c88277cf3fee6326236a8a0f8..00a60794ac7403de717d655b639fe43e059a4b65 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/DllOpen.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/DllOpen.h @@ -9,7 +9,6 @@ namespace Mantid { namespace Kernel { -class Logger; /** @class DllOpen DllOpen.h @@ -83,9 +82,6 @@ private: /// Implementation specifc static method for adding a directiry to the dll search path. static void addSearchDirectoryImpl(const std::string&); - /// Static reference to the logger class - static Mantid::Kernel::Logger& log; - ///lib prefix static const std::string LIB_PREFIX; ///lib postfix diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FacilityInfo.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FacilityInfo.h index 8f72726b527ffa5531bf1326e64435f38b550549..21365af947bedb8b107b19653471129057807c04 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FacilityInfo.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FacilityInfo.h @@ -6,7 +6,6 @@ //---------------------------------------------------------------------- #include "MantidKernel/DllConfig.h" #include "MantidKernel/CatalogInfo.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/InstrumentInfo.h" #include "MantidKernel/RemoteJobManager.h" @@ -111,7 +110,6 @@ private: typedef std::map< std::string, boost::shared_ptr<RemoteJobManager> > ComputeResourcesMap; ComputeResourcesMap m_computeResources; ///< list of compute resources (clusters, etc...) available at this facility // (Sorted by their names) - static Logger& g_log; ///< logger }; } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileValidator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileValidator.h index fde97345c355c5f5b7def3eb0000ed82c6ee91ec..f6d444dba8ba829759b51622c27f6ccc22885f5e 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileValidator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileValidator.h @@ -58,9 +58,6 @@ protected: private: virtual std::string checkValidity(const std::string &value) const; bool endswith(const std::string &value) const; - - /// A reference to the logger - static Logger & g_log; }; } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/IValidator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/IValidator.h index 7b2c449f1f6b3f6c2d36ae4a545f6607602cc53c..2cee658eaf99da1622894895b1bc771492d3309a 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/IValidator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/IValidator.h @@ -6,7 +6,6 @@ //---------------------------------------------------------------------- #include "MantidKernel/DllConfig.h" #include "MantidKernel/DataItem.h" -#include "MantidKernel/Logger.h" #include <boost/any.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/InstrumentInfo.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/InstrumentInfo.h index c4d34de8a8002df4fc1d79508bf573a67efdda4f..7e1ad68b9bbda79cf208f587ccaf4568bcdf6a4b 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/InstrumentInfo.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/InstrumentInfo.h @@ -5,7 +5,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidKernel/DllConfig.h" -#include "MantidKernel/Logger.h" #include <set> #include <string> #include <map> @@ -100,7 +99,6 @@ private: std::string m_liveListener; ///< Name of the live listener class std::string m_liveDataAddress; ///< Host & port for live data connection std::set<std::string> m_technique; ///< List of techniques the instrument can do - static Logger& g_log; ///< Logger }; /// Allow this object to be printed to a stream diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Interpolation.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Interpolation.h index 7178d164c0bbe279abd37ea10885b02c04dd704f..04185c419d4d1ec10c59155dbaa25caece63128e 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Interpolation.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Interpolation.h @@ -7,7 +7,6 @@ #include "MantidKernel/Property.h" #include "MantidKernel/Exception.h" #include "MantidKernel/DllConfig.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/DateAndTime.h" #include "MantidKernel/Unit.h" #include <map> @@ -98,8 +97,6 @@ public: /// Prints object to stream void printSelf(std::ostream& os) const; - /// static reference to the logger class - static Logger& g_log; }; // defining operator << and >> diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LibraryManager.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LibraryManager.h index 3bd115a806297561fe62a19ac8cb015ff9962efc..003f77bebd36af46f96047ba8134d018e9e9a033 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LibraryManager.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LibraryManager.h @@ -10,13 +10,13 @@ #include "MantidKernel/SingletonHolder.h" #include "MantidKernel/DllConfig.h" -#include "MantidKernel/LibraryWrapper.h" namespace Mantid { namespace Kernel { - class Logger; + class LibraryWrapper; + /** Class for opening shared libraries. @@ -66,9 +66,6 @@ namespace Mantid bool skip(const std::string & filename); ///Storage for the LibraryWrappers. std::map< const std::string, boost::shared_ptr<Mantid::Kernel::LibraryWrapper> > OpenLibs; - - /// static reference to the logger class - Logger& g_log; }; ///Forward declaration of a specialisation of SingletonHolder for LibraryManagerImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogParser.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogParser.h index 034b646dc7fc74385ea543a95c14f64bad3cf38f..112a06816695c1474216c9d5a94493afba993844 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogParser.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogParser.h @@ -5,7 +5,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidKernel/DllConfig.h" -#include "MantidKernel/Logger.h" #include <boost/shared_ptr.hpp> @@ -112,9 +111,6 @@ namespace Mantid /// Number of periods int m_nOfPeriods; - /// static reference to the logger class - static Kernel::Logger& g_log; - /// Creates a map of all available old-style commands. CommandMap createCommandMap(bool newStyle) const; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Logger.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Logger.h index c2ae494d748e4b6170d5b2a8965b9df5d7350c7c..0264197e01993ccb3acdd62a4dfa8c893fd1b52b 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Logger.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Logger.h @@ -75,7 +75,6 @@ class ThreadSafeLogStream; Logger(const std::string& name); /// Destructor ~Logger(); - /// Update the name of the logger void setName(const std::string & name); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Memory.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Memory.h index ab6e8ed35da193a0d5e32aafa99323a7cf072a95..988666a9652590ef07267e33c976c6cac9cfbc3e 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Memory.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Memory.h @@ -4,7 +4,6 @@ #include <string> #include "MantidKernel/DllConfig.h" #include "MantidKernel/MultiThreaded.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -65,7 +64,6 @@ namespace Mantid std::size_t res_usage; ///< Resident memory usage by process in kiB. std::size_t total_memory; ///< Total physical memory of system in kiB. std::size_t avail_memory; ///< Available memory of system in kiB. - static Logger &g_log; ///< Logger friend MANTID_KERNEL_DLL std::ostream& operator<<(std::ostream& out, const MemoryStats &stats); /// Mutex to avoid simultaneous access to memory resources static Mutex mutexMemory; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MultiFileValidator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MultiFileValidator.h index 304d8c5e688ffadf37e806cf93e1c3d47c8e11ea..b784cdd1b773786064595bbe0fd13f0ae5b07b2b 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MultiFileValidator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MultiFileValidator.h @@ -60,9 +60,6 @@ protected: private: /// Returns an error if at least one of the files is not valid, else "". virtual std::string checkValidity(const std::vector<std::vector<std::string> > &values) const; - - /// A reference to the logger - static Logger & g_log; }; } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManager.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManager.h index 56ae69bc296c8d2c024798140298905f5b9fe8e0..7595832b55220d6505c187399e9e3df75e663ea9 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManager.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManager.h @@ -16,7 +16,6 @@ namespace Kernel //---------------------------------------------------------------------- // Forward Declaration //---------------------------------------------------------------------- -class Logger; class SplittingInterval; template<typename T> class TimeSeriesProperty; @@ -111,9 +110,6 @@ private: PropertyMap m_properties; /// Stores the order in which the properties were declared. std::vector<Property*> m_orderedProperties; - - /// Static reference to the logger class - static Logger& g_log; }; /// Typedef for a shared pointer to a PropertyManager diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h index 0ec82288b0a34705bccf10b30a3d8c4ac01ffb7a..aa920e6fc32b75767ccf8e65b009dfcefd3aeedd 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h @@ -16,7 +16,6 @@ namespace Kernel //---------------------------------------------------------------------- // Forward Declaration //---------------------------------------------------------------------- -class Logger; class PropertyManager; /** @class PropertyManagerOwner PropertyManagerOwner.h Kernel/PropertyManagerOwner.h @@ -105,11 +104,6 @@ private: /// Shared pointer to the 'real' property manager boost::shared_ptr<PropertyManager> m_properties; - - /// Static reference to the logger class - static Logger& g_log; - - }; } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h index 59b239223c778a372841871713f3a2876e9fb250..c7a87ce250d6fd048b780e95e1ef1ce03606db90 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h @@ -361,12 +361,12 @@ public: { std::string error = "Could not set property " + name() + ". Can not convert \"" + value + "\" to " + type(); - g_log.debug() << error; + g_logger.debug() << error; return error; } catch ( std::invalid_argument& except) { - g_log.debug() << "Could not set property " << name() << ": " << except.what(); + g_logger.debug() << "Could not set property " << name() << ": " << except.what(); return except.what(); } return ""; @@ -411,7 +411,8 @@ public: addingOperator(m_value, rhs->m_value); } else - g_log.warning() << "PropertyWithValue " << this->name() << " could not be added to another property of the same name but incompatible type.\n"; + g_logger.warning() << "PropertyWithValue " << this->name() + << " could not be added to another property of the same name but incompatible type.\n"; return *this; } @@ -564,7 +565,7 @@ private: IValidator_sptr m_validator; /// Static reference to the logger class - static Logger& g_log; + static Logger g_logger; /// Private default constructor PropertyWithValue(); @@ -572,7 +573,7 @@ private: template <typename TYPE> -Logger& PropertyWithValue<TYPE>::g_log = Logger::get("PropertyWithValue"); +Logger PropertyWithValue<TYPE>::g_logger("PropertyWithValue"); } // namespace Kernel } // namespace Mantid diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Quat.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Quat.h index 003a8c856505c2f21666ce7d295742f631333457..7fa9744e5dd3e765ca36967a7dabbaa76d4ba367 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Quat.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Quat.h @@ -3,7 +3,6 @@ #include "MantidKernel/DllConfig.h" #include "MantidKernel/Matrix.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -150,9 +149,6 @@ namespace Mantid double b; /// Internal value double c; - - // Logger - static Kernel::Logger& quat_log; }; MANTID_KERNEL_DLL std::ostream& operator<<(std::ostream&, const Quat&); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/RemoteJobManager.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/RemoteJobManager.h index a52c689686c4fde093554e9448b2e7878f0f3470..ad5e2f02f4601a335b0fbba6b9f44ad440950aeb 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/RemoteJobManager.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/RemoteJobManager.h @@ -85,8 +85,6 @@ private: // it multiple times) Poco::Net::HTTPResponse m_response; // Response object for all of our HTTP requests - static Mantid::Kernel::Logger& g_log; ///< reference to the logger class - // No default copy constructor or assignment operator (mainly because // HTTPResponse doesn't have them RemoteJobManager( const RemoteJobManager & rjm); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h index 1db6fd763e432f64253792e83993a48d90367a8f..21647f00f0d38ea68ae3ba5d9766f21fff194330 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h @@ -7,7 +7,6 @@ #include "MantidKernel/DllConfig.h" #include "MantidKernel/DateAndTime.h" #include "MantidKernel/ITimeSeriesProperty.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/Property.h" #include "MantidKernel/Statistics.h" #include <utility> @@ -309,16 +308,8 @@ namespace Mantid mutable std::vector<std::pair<size_t, size_t> > m_filterQuickRef; /// True if a filter has been applied mutable bool m_filterApplied; - - /// Static reference to the logger class - static Logger& g_log; }; - /// Logger definition - template <typename TYPE> - Logger& TimeSeriesProperty<TYPE>::g_log = Logger::get("TimeSeriesProperty"); - - /// Function filtering double TimeSeriesProperties according to the requested statistics. double DLLExport filterByStatistic(TimeSeriesProperty<double> const * const propertyToFilter, Kernel::Math::StatisticType statistic_type); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitFactory.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitFactory.h index b6eb73f2b8688780a8a648a39fdcd7d6224b74dd..bb65883f7e8583164ba0ae801c2757454c7b78c7 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitFactory.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitFactory.h @@ -34,7 +34,6 @@ namespace Kernel // Forward declaration //---------------------------------------------------------------------- class Unit; -class Logger; /** Creates instances of concrete units. The factory is a singleton that hands out shared pointers to the base Unit class. @@ -79,9 +78,6 @@ private: UnitFactoryImpl& operator = (const UnitFactoryImpl&); ///Private Destructor virtual ~UnitFactoryImpl(); - - /// Reference to the logger class - Kernel::Logger& m_log; }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) . diff --git a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp index 780c54e2a0e003d9c5eae61cdb8879b92d4f4515..c829caa436b81f716fed8eb6b20f5a9947d5c7ae 100644 --- a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp @@ -63,6 +63,10 @@ namespace Kernel namespace { // anonymous namespace for some utility functions +/// static Logger object +Logger g_log("ConfigService"); + + /** * Split the supplied string on semicolons. * @@ -166,7 +170,7 @@ private: /// Private constructor for singleton class ConfigServiceImpl::ConfigServiceImpl() : - m_pConf(NULL), m_pSysConfig(NULL), g_log(Logger::get("ConfigService")), m_changed_keys(), + m_pConf(NULL), m_pSysConfig(NULL), m_changed_keys(), m_ConfigPaths(), m_AbsolutePaths(), m_strBaseDir(""), m_PropertyString(""), m_properties_file_name("Mantid.properties"), #ifdef MPI_BUILD @@ -1750,11 +1754,11 @@ bool ConfigServiceImpl::quickParaViewCheck() const const bool ignoreParaview = hasProperty(paraviewIgnoreProperty) && atoi(getString(paraviewIgnoreProperty).c_str()); if(ignoreParaview) { - this->g_log.debug("Ignoring ParaView"); + g_log.debug("Ignoring ParaView"); return false; } - this->g_log.debug("Checking for ParaView"); + g_log.debug("Checking for ParaView"); bool isAvailable = false; try @@ -1781,7 +1785,7 @@ bool ConfigServiceImpl::quickParaViewCheck() const if (givenVersionNumber == targetVersionNumber) { isAvailable = true; - this->g_log.information("ParaView is available"); + g_log.information("ParaView is available"); // Now set the plugin path. this->setParaViewPluginPath(); } @@ -1789,22 +1793,22 @@ bool ConfigServiceImpl::quickParaViewCheck() const { std::stringstream messageStream; messageStream << "The compatible version of ParaView is " << targetVersionNumber << " but the installed version is " << givenVersionNumber; - this->g_log.debug(messageStream.str()); - this->g_log.information("ParaView is not available"); + g_log.debug(messageStream.str()); + g_log.information("ParaView is not available"); } } else { std::stringstream messageStream; messageStream << "ParaView version query failed with code: " << rc; - this->g_log.debug(messageStream.str()); - this->g_log.information("ParaView is not available"); + g_log.debug(messageStream.str()); + g_log.information("ParaView is not available"); } } catch(Poco::SystemException &e) { - this->g_log.debug(e.what()); - this->g_log.information("ParaView is not available"); + g_log.debug(e.what()); + g_log.information("ParaView is not available"); } return isAvailable; } diff --git a/Code/Mantid/Framework/Kernel/src/DateAndTime.cpp b/Code/Mantid/Framework/Kernel/src/DateAndTime.cpp index 0284d1c7da29f97910686a28a43dca594e429ab6..ef660f4fe5df0117a6a61ae91be7f82cee4f6efc 100644 --- a/Code/Mantid/Framework/Kernel/src/DateAndTime.cpp +++ b/Code/Mantid/Framework/Kernel/src/DateAndTime.cpp @@ -13,21 +13,23 @@ namespace Mantid namespace Kernel { +namespace +{ // Initialize the logger -Logger& DateAndTime::g_log = Logger::get("DateAndTime"); +Logger g_log("DateAndTime"); /// Max allowed nanoseconds in the time; 2^62-1 -static int64_t MAX_NANOSECONDS = 4611686018427387903LL; +int64_t MAX_NANOSECONDS = 4611686018427387903LL; /// Max allowed seconds in the time -static int64_t MAX_SECONDS = 4611686017LL; +int64_t MAX_SECONDS = 4611686017LL; /// Min allowed nanoseconds in the time; -2^62+1 -static int64_t MIN_NANOSECONDS = -4611686018427387903LL; +int64_t MIN_NANOSECONDS = -4611686018427387903LL; /// Min allowed seconds in the time -static int64_t MIN_SECONDS = -4611686017LL; - +int64_t MIN_SECONDS = -4611686017LL; +} namespace DateAndTimeHelpers { diff --git a/Code/Mantid/Framework/Kernel/src/DirectoryValidator.cpp b/Code/Mantid/Framework/Kernel/src/DirectoryValidator.cpp index 33c86eb18035ae857b6a20d8ee9f57e5227e0d87..e2e6e775e55b9b884f070a10739e32f1cd517bd1 100644 --- a/Code/Mantid/Framework/Kernel/src/DirectoryValidator.cpp +++ b/Code/Mantid/Framework/Kernel/src/DirectoryValidator.cpp @@ -9,9 +9,6 @@ namespace Mantid namespace Kernel { -// Initialize the logger -Logger& DirectoryValidator::g_log = Logger::get("DirectoryValidator"); - /** Constructor * @param testDirectoryExists :: Flag indicating whether to test for existence of directory (default: yes) */ diff --git a/Code/Mantid/Framework/Kernel/src/DllOpen.cpp b/Code/Mantid/Framework/Kernel/src/DllOpen.cpp index 219fd38927a5a4cee3bbd0dc88582e8f782a2af6..e58a0d060dce83b9579e3ad6034d5bac9a671a62 100644 --- a/Code/Mantid/Framework/Kernel/src/DllOpen.cpp +++ b/Code/Mantid/Framework/Kernel/src/DllOpen.cpp @@ -12,7 +12,6 @@ #if _WIN32 #define _WIN32_WINNT 0x0510 #include <windows.h> -//#include <strsafe.h> #else #include <dlfcn.h> #endif /* _WIN32 */ @@ -26,8 +25,11 @@ namespace Mantid namespace Kernel { -// Get a reference to the logger -Logger& DllOpen::log = Logger::get("DllOpen"); + namespace + { + // Static logger object + Logger g_log("DllOpen"); + } /* Opens the shared library after appending the required formatting, * i.e. libName.so for Linux and Name.dll for Windows. @@ -156,7 +158,7 @@ void* DllOpen::OpenDllImpl(const std::string& filePath) // TEXT("failed with error %d: %s"), // dw, lpMsgBuf); _snprintf((char*)lpDisplayBuf, n, "failed with error %lu: %s", dw, lpMsgBuf); - log.error()<<"Could not open library " << filePath << ": " << (LPCTSTR)lpDisplayBuf << std::endl; + g_log.error()<<"Could not open library " << filePath << ": " << (LPCTSTR)lpDisplayBuf << std::endl; LocalFree(lpMsgBuf); LocalFree(lpDisplayBuf); @@ -211,7 +213,7 @@ void* DllOpen::OpenDllImpl(const std::string& filePath) void* handle = dlopen(filePath.c_str(), RTLD_NOW | RTLD_GLOBAL); if (!handle) { - log.error("Could not open library " + filePath + ": " + dlerror()); + g_log.error("Could not open library " + filePath + ": " + dlerror()); } return handle; } diff --git a/Code/Mantid/Framework/Kernel/src/FacilityInfo.cpp b/Code/Mantid/Framework/Kernel/src/FacilityInfo.cpp index 3984e059e8605df8a810a065c0fbd4d2fed6a333..0924d0c77d4710657995f64dec85c7e57ad46135 100644 --- a/Code/Mantid/Framework/Kernel/src/FacilityInfo.cpp +++ b/Code/Mantid/Framework/Kernel/src/FacilityInfo.cpp @@ -2,9 +2,10 @@ // Includes //---------------------------------------------------------------------- #include "MantidKernel/FacilityInfo.h" -#include "MantidKernel/Strings.h" -#include "MantidKernel/Exception.h" #include "MantidKernel/ConfigService.h" +#include "MantidKernel/Exception.h" +#include "MantidKernel/Logger.h" +#include "MantidKernel/Strings.h" #include <Poco/DOM/Element.h> #include <Poco/DOM/NodeList.h> @@ -21,7 +22,11 @@ namespace Mantid namespace Kernel { -Logger& FacilityInfo::g_log(Logger::get("FacilityInfo")); +namespace +{ + /// static logger + Logger g_log("FacilityInfo"); +} /** Constructor. * @param elem :: The Poco::XML::Element to read the data from diff --git a/Code/Mantid/Framework/Kernel/src/FileValidator.cpp b/Code/Mantid/Framework/Kernel/src/FileValidator.cpp index c0b0f5b3b28c84ebc02f048773d491b31ff85bf9..254444b8a284870cef95d725124ee259fe871084 100644 --- a/Code/Mantid/Framework/Kernel/src/FileValidator.cpp +++ b/Code/Mantid/Framework/Kernel/src/FileValidator.cpp @@ -1,4 +1,5 @@ #include "MantidKernel/FileValidator.h" +#include "MantidKernel/Logger.h" #include <algorithm> #include <Poco/File.h> #include <Poco/Path.h> @@ -22,8 +23,11 @@ namespace Mantid namespace Kernel { -// Initialize the logger -Logger& FileValidator::g_log = Logger::get("FileValidator"); +namespace +{ + // Initialize the static logger + Logger g_log("FileValidator"); +} /** Constructor * @param extensions :: The permitted file extensions (e.g. .RAW) @@ -78,10 +82,10 @@ std::string FileValidator::checkValidity(const std::string &value) const //Dropped from warning to debug level as it was printing out on every search of the archive, even when successful. re #5998 g_log.debug() << "Unrecognised extension in file \"" << value << "\""; if (!this->m_extensions.empty()) { - this->g_log.debug() << " [ "; + g_log.debug() << " [ "; for (std::set<std::string>::const_iterator it = this->m_extensions.begin(); it != this->m_extensions.end(); ++it) g_log.debug() << *it << " "; - this->g_log.debug() << "]"; + g_log.debug() << "]"; } g_log.debug() << "\"." << std::endl; } diff --git a/Code/Mantid/Framework/Kernel/src/InstrumentInfo.cpp b/Code/Mantid/Framework/Kernel/src/InstrumentInfo.cpp index 8056ad096bdfab9413992f7842e299554c2244c1..4044beaf6dcf15d5d42fa04d23c87441e65ef63b 100644 --- a/Code/Mantid/Framework/Kernel/src/InstrumentInfo.cpp +++ b/Code/Mantid/Framework/Kernel/src/InstrumentInfo.cpp @@ -4,6 +4,7 @@ #include "MantidKernel/InstrumentInfo.h" #include "MantidKernel/FacilityInfo.h" #include "MantidKernel/Exception.h" +#include "MantidKernel/Logger.h" #include "MantidKernel/Strings.h" #include <Poco/DOM/Element.h> @@ -19,8 +20,11 @@ namespace Mantid { namespace Kernel { - - Logger& InstrumentInfo::g_log = Logger::get("InstrumentInfo"); + namespace + { + // static logger object + Logger g_log("InstrumentInfo"); + } /** Constructor. * @param f :: The facility @@ -34,7 +38,6 @@ namespace Mantid m_name = elem->getAttribute("name"); if (m_name.empty()) { - g_log.error("Instrument name is not defined"); throw std::runtime_error("Instrument name is not defined"); } @@ -175,14 +178,12 @@ namespace Mantid // read the zero padding size if ( !elem->hasAttribute("size") ) { - g_log.error("Zeropadding size is missing for instrument "+m_name); throw std::runtime_error("Zeropadding size is missing for instrument "+m_name); } auto& sizeStr = elem->getAttribute("size"); int size = 0; if ( !Mantid::Kernel::Strings::convert(sizeStr,size) ) { - g_log.error("Zeropadding size must be an integer value (instrument "+m_name+")"); throw std::runtime_error("Zeropadding size must be an integer value (instrument "+m_name+")"); } // read the start run number @@ -191,7 +192,6 @@ namespace Mantid { if ( !m_zeroPadding.empty() ) { - g_log.error("Zeropadding size is missing for instrument "+m_name); throw std::runtime_error("Zeropadding size is missing for instrument "+m_name); } } @@ -204,7 +204,6 @@ namespace Mantid } catch(...) { - g_log.error("Zeropadding start run number must be an integer value (instrument "+m_name+")"); throw std::runtime_error("Zeropadding start run number must be an integer value (instrument "+m_name+")"); } } @@ -248,7 +247,6 @@ namespace Mantid if (m_technique.empty()) { - g_log.error("No technique is defined for instrument "+m_name); throw std::runtime_error("No technique is defined for instrument "+m_name); } } diff --git a/Code/Mantid/Framework/Kernel/src/Interpolation.cpp b/Code/Mantid/Framework/Kernel/src/Interpolation.cpp index 60030332fa4b75e9b078bebb31f4719ccf280166..dcbc771ee25d4e87bacd5268a0d21fc34c99822e 100644 --- a/Code/Mantid/Framework/Kernel/src/Interpolation.cpp +++ b/Code/Mantid/Framework/Kernel/src/Interpolation.cpp @@ -1,13 +1,17 @@ #include "MantidKernel/Interpolation.h" -#include <Poco/StringTokenizer.h> +#include "MantidKernel/Logger.h" #include "MantidKernel/UnitFactory.h" +#include <Poco/StringTokenizer.h> namespace Mantid { namespace Kernel { - - Logger& Interpolation::g_log = Logger::get("Interpolation"); + namespace + { + /// static logger + Logger g_log("Interpolation"); + } /** Constructor default to linear interpolation and x-unit set to TOF */ diff --git a/Code/Mantid/Framework/Kernel/src/LibraryManager.cpp b/Code/Mantid/Framework/Kernel/src/LibraryManager.cpp index ea461edc292967cc28fe46c7ab5dc5e5c02f57b1..f4e0dd0f28a7e73e5c84978976f4869a8166a43d 100644 --- a/Code/Mantid/Framework/Kernel/src/LibraryManager.cpp +++ b/Code/Mantid/Framework/Kernel/src/LibraryManager.cpp @@ -1,8 +1,9 @@ #include <iostream> +#include "MantidKernel/ConfigService.h" #include "MantidKernel/DllOpen.h" #include "MantidKernel/LibraryManager.h" -#include "MantidKernel/ConfigService.h" +#include "MantidKernel/LibraryWrapper.h" #include "MantidKernel/Logger.h" #include <Poco/Path.h> @@ -14,10 +15,14 @@ namespace Mantid { namespace Kernel { + namespace + { + /// static logger + Logger g_log("LibraryManager"); + } /// Constructor - LibraryManagerImpl::LibraryManagerImpl() - : g_log(Logger::get("LibraryManager")) + LibraryManagerImpl::LibraryManagerImpl() { g_log.debug() << "LibraryManager created." << std::endl; } diff --git a/Code/Mantid/Framework/Kernel/src/LogParser.cpp b/Code/Mantid/Framework/Kernel/src/LogParser.cpp index d593795a8b78695cd39b21951b4f856db105df31..d38e68bb65c6568388afcaf6d332ff49a4edfb2d 100644 --- a/Code/Mantid/Framework/Kernel/src/LogParser.cpp +++ b/Code/Mantid/Framework/Kernel/src/LogParser.cpp @@ -2,9 +2,10 @@ // Includes //---------------------------------------------------------------------- #include "MantidKernel/LogParser.h" +#include "MantidKernel/Logger.h" +#include "MantidKernel/PropertyWithValue.h" #include "MantidKernel/TimeSeriesProperty.h" -#include "MantidKernel/PropertyWithValue.h" #include <algorithm> #include <fstream> @@ -21,8 +22,11 @@ namespace Mantid { namespace Kernel { - - Kernel::Logger& LogParser::g_log = Mantid::Kernel::Logger::get("LogParser"); + namespace + { + /// static logger + Logger g_log("LogParser"); + } /// @returns the name of the log created that defines the status during a run const std::string LogParser::statusLogName() diff --git a/Code/Mantid/Framework/Kernel/src/Memory.cpp b/Code/Mantid/Framework/Kernel/src/Memory.cpp index 330bfd45f1966e0ccd1917b779024f3c3d235bb9..dfa5b19a734119d7a9611f815a27ba78dfefb89f 100644 --- a/Code/Mantid/Framework/Kernel/src/Memory.cpp +++ b/Code/Mantid/Framework/Kernel/src/Memory.cpp @@ -1,3 +1,6 @@ +#include "MantidKernel/Memory.h" +#include "MantidKernel/Logger.h" + #include <iostream> #include <iomanip> #include <sstream> @@ -22,8 +25,6 @@ #include <Psapi.h> #endif -#include "MantidKernel/Memory.h" -#include "MantidKernel/System.h" using std::size_t; using std::string; @@ -32,6 +33,12 @@ namespace Mantid { namespace Kernel { +namespace +{ + /// static logger object + Logger g_log("Memory"); +} + /// Utility function to convert memory in kiB into easy to read units. template <typename TYPE> @@ -287,19 +294,19 @@ void MemoryOptions::initAllocatorOptions() */ mallopt(M_MMAP_THRESHOLD, 8*4096); #elif _WIN32 - Kernel::Logger &g_log = Kernel::Logger::get("MemoryOptions"); + Logger memOptLogger("MemoryOptions"); // Try to enable the Low Fragmentation Heap for all heaps // Bit of a brute force approach, but don't know which heap workspace data ends up on HANDLE hHeaps[1025]; // Get the number of heaps const DWORD numHeap = GetProcessHeaps(1024, hHeaps); - g_log.debug() << "Number of heaps: " << numHeap << "\n";//GetProcessHeaps(0, NULL) << "\n"; + memOptLogger.debug() << "Number of heaps: " << numHeap << "\n";//GetProcessHeaps(0, NULL) << "\n"; ULONG ulEnableLFH = 2; // 2 = Low Fragmentation Heap for(DWORD i = 0; i < numHeap; i++) { if(!HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH))) { - g_log.debug() << "Failed to enable the LFH for heap " << i << "\n"; + memOptLogger.debug() << "Failed to enable the LFH for heap " << i << "\n"; } } #endif @@ -308,9 +315,6 @@ void MemoryOptions::initAllocatorOptions() // ------------------ The actual class ---------------------------------------- -/// Initialize the logger -Kernel::Logger & MemoryStats::g_log = Kernel::Logger::get("Memory"); - /** * Constructor * @param ignore :: Which memory stats should be ignored. diff --git a/Code/Mantid/Framework/Kernel/src/MultiFileValidator.cpp b/Code/Mantid/Framework/Kernel/src/MultiFileValidator.cpp index c73ab28f077ce8d8f7f567c6c27213a31e22ef32..d1edf007089f32fddde62d5bedc86b312f26139b 100644 --- a/Code/Mantid/Framework/Kernel/src/MultiFileValidator.cpp +++ b/Code/Mantid/Framework/Kernel/src/MultiFileValidator.cpp @@ -1,7 +1,8 @@ #include "MantidKernel/MultiFileValidator.h" -#include <algorithm> +#include "MantidKernel/Logger.h" #include <Poco/File.h> #include <Poco/Path.h> +#include <algorithm> #include <iostream> @@ -9,8 +10,11 @@ namespace Mantid { namespace Kernel { - // Initialize the logger - Logger& MultiFileValidator::g_log = Logger::get("MultiFileValidator"); + namespace + { + // static logger + Logger g_log("MultiFileValidator"); + } /// Default constructor. MultiFileValidator::MultiFileValidator() : TypedValidator<std::vector<std::vector<std::string> > >(), diff --git a/Code/Mantid/Framework/Kernel/src/PropertyManager.cpp b/Code/Mantid/Framework/Kernel/src/PropertyManager.cpp index 8d1d820973d7b94b457aa1b4327701ac8c505634..eb24fad2aea290f22fd153404d80d5115ee18aa4 100644 --- a/Code/Mantid/Framework/Kernel/src/PropertyManager.cpp +++ b/Code/Mantid/Framework/Kernel/src/PropertyManager.cpp @@ -3,8 +3,8 @@ //---------------------------------------------------------------------- #include "MantidKernel/PropertyManager.h" #include "MantidKernel/Exception.h" -#include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/FilteredTimeSeriesProperty.h" +#include "MantidKernel/TimeSeriesProperty.h" #include <boost/tokenizer.hpp> #include <boost/algorithm/string/trim.hpp> @@ -17,8 +17,11 @@ namespace Mantid using std::string; - // Get a reference to the logger - Logger& PropertyManager::g_log = Logger::get("PropertyManager"); + namespace + { + // static logger reference + Logger g_log("PropertyManager"); + } //----------------------------------------------------------------------------------------------- /// Default constructor diff --git a/Code/Mantid/Framework/Kernel/src/PropertyManagerOwner.cpp b/Code/Mantid/Framework/Kernel/src/PropertyManagerOwner.cpp index 095a3ba6e85b3bc69f11d64d10ab1cedf29087b6..4b2bf7ce791be4c968523b918d7505a432af50e4 100644 --- a/Code/Mantid/Framework/Kernel/src/PropertyManagerOwner.cpp +++ b/Code/Mantid/Framework/Kernel/src/PropertyManagerOwner.cpp @@ -10,9 +10,11 @@ namespace Mantid { namespace Kernel { - - // Get a reference to the logger - Logger& PropertyManagerOwner::g_log = Logger::get("PropertyManagerOwner"); + namespace + { + // Get a reference to the logger + Logger g_log("PropertyManagerOwner"); + } /// Default constructor PropertyManagerOwner::PropertyManagerOwner() : diff --git a/Code/Mantid/Framework/Kernel/src/Quat.cpp b/Code/Mantid/Framework/Kernel/src/Quat.cpp index 680eef632ce20c9b33f13ca44a319761270ebab8..f82656e4f34222c5006d64c06e1560970b54c993 100644 --- a/Code/Mantid/Framework/Kernel/src/Quat.cpp +++ b/Code/Mantid/Framework/Kernel/src/Quat.cpp @@ -1,6 +1,8 @@ #include "MantidKernel/Quat.h" -#include "MantidKernel/V3D.h" +#include "MantidKernel/Logger.h" #include "MantidKernel/Tolerance.h" +#include "MantidKernel/V3D.h" + #include <cmath> #include <stdexcept> #include <cstdlib> @@ -11,8 +13,10 @@ namespace Mantid { namespace Kernel { - - Kernel::Logger& Quat::quat_log = Kernel::Logger::get("Kernel:Quat"); + namespace + { + Logger g_log("Quat"); + } /** Null Constructor * Initialize the quaternion with the identity q=1.0+0i+0j+0k; @@ -533,10 +537,10 @@ Quat::getRotation(bool check_normalisation,bool throw_on_errors)const double normSq=aa+bb+cc+w*w; if(fabs(normSq-1)>FLT_EPSILON){ if(throw_on_errors){ - quat_log.error()<<" A non-unit quaternion used to obtain a rotation matrix; need to notmalize it first\n"; + g_log.error()<<" A non-unit quaternion used to obtain a rotation matrix; need to notmalize it first\n"; throw(std::invalid_argument("Attempt to use non-normalized quaternion to define rotation matrix; need to notmalize it first")); }else{ - quat_log.information()<<" Warning; a non-unit quaternion used to obtain the rotation matrix; using normalized quat\n"; + g_log.information()<<" Warning; a non-unit quaternion used to obtain the rotation matrix; using normalized quat\n"; aa/=normSq; ab/=normSq; ac/=normSq; diff --git a/Code/Mantid/Framework/Kernel/src/RemoteJobManager.cpp b/Code/Mantid/Framework/Kernel/src/RemoteJobManager.cpp index f948b6fd6455cb21de103a6377d466fede10c086..5ce7ec800422f1925224c5b215d9761eec1eafee 100644 --- a/Code/Mantid/Framework/Kernel/src/RemoteJobManager.cpp +++ b/Code/Mantid/Framework/Kernel/src/RemoteJobManager.cpp @@ -23,8 +23,11 @@ namespace Mantid namespace Kernel { -// Get a reference to the logger -Logger& RemoteJobManager::g_log = Logger::get("RemoteJobManager"); +namespace +{ + // static logger object + Logger g_log("RemoteJobManager"); +} RemoteJobManager::RemoteJobManager( const Poco::XML::Element* elem) : m_displayName( elem->getAttribute("name")), diff --git a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp index 632ec7c1ae258a1e6b4e19af99670c82c18cb1fe..8ac4dabcb0314147720b80aa1a35a1ae3a2a6248 100644 --- a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -2,6 +2,7 @@ #include "MantidKernel/DateAndTime.h" #include "MantidKernel/EmptyValues.h" #include "MantidKernel/Exception.h" +#include "MantidKernel/Logger.h" #include "MantidKernel/TimeSplitter.h" #include <sstream> @@ -12,7 +13,11 @@ namespace Mantid { namespace Kernel { - + namespace + { + /// static Logger definition + Logger g_log("TimeSeriesProperty"); + } /** * Constructor diff --git a/Code/Mantid/Framework/Kernel/src/UnitFactory.cpp b/Code/Mantid/Framework/Kernel/src/UnitFactory.cpp index ff2bbcc766891af70012e42852e76ed250c3ed30..edc4e5f3e987a143a7f17d100d04b1aa5d9b1b51 100644 --- a/Code/Mantid/Framework/Kernel/src/UnitFactory.cpp +++ b/Code/Mantid/Framework/Kernel/src/UnitFactory.cpp @@ -1,5 +1,4 @@ #include "MantidKernel/UnitFactory.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -7,7 +6,7 @@ namespace Kernel { UnitFactoryImpl::UnitFactoryImpl() : - DynamicFactory<Unit>(), m_log(Kernel::Logger::get("UnitFactory")) + DynamicFactory<Unit>() { } diff --git a/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h b/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h index d226f1cb0a44eb620423057605277f27fa84ba3b..1c9039fb0b3787884358500f31fd0e7a4f558f48 100644 --- a/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h +++ b/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h @@ -33,7 +33,7 @@ public: Mantid::Kernel::Logger::setLevelForAll(Poco::Message::PRIO_NOTICE); //attempt some logging - Logger& log1 = Logger::get("logTest"); + Logger log1("logTest"); TS_ASSERT_THROWS_NOTHING(log1.debug("a debug string")); TS_ASSERT_THROWS_NOTHING(log1.information("an information string")); @@ -66,7 +66,7 @@ public: void testEnabled() { //attempt some logging - Logger& log1 = Logger::get("logTestEnabled"); + Logger log1("logTestEnabled"); TS_ASSERT(log1.getEnabled()); TS_ASSERT_THROWS_NOTHING(log1.fatal("a fatal string with enabled=true")); TS_ASSERT_THROWS_NOTHING(log1.fatal()<<"A fatal message from the stream operators with enabled=true " << 4.5 << std::endl;); @@ -83,27 +83,10 @@ public: } - void testChangeName() - { - //attempt some logging - Logger& log1 = Logger::get("logTestName1"); - TS_ASSERT_THROWS_NOTHING(log1.error("This should be from logTestName1")); - TS_ASSERT_THROWS_NOTHING(log1.error()<<"This should be from logTestName1 via a stream" << std::endl;); - - TS_ASSERT_THROWS_NOTHING(log1.setName("logTestName2")); - TS_ASSERT_THROWS_NOTHING(log1.error("This should be from logTestName2")); - TS_ASSERT_THROWS_NOTHING(log1.error()<<"This should be from logTestName2 via a stream" << std::endl;); - - TS_ASSERT_THROWS_NOTHING(log1.setName("logTestName1")); - TS_ASSERT_THROWS_NOTHING(log1.error("This should be from logTestName1")); - TS_ASSERT_THROWS_NOTHING(log1.error()<<"This should be from logTestName1 via a stream" << std::endl;); - - } - void testLogLevelOffset() { //attempt some logging - Logger& log1 = Logger::get("logTestOffset"); + Logger log1("logTestOffset"); log1.setLevelOffset(0); TS_ASSERT_THROWS_NOTHING(log1.fatal("a fatal string with offset 0")); log1.setLevelOffset(-1); diff --git a/Code/Mantid/Framework/Kernel/test/StdoutChannelTest.h b/Code/Mantid/Framework/Kernel/test/StdoutChannelTest.h index 265438eb900bd7757a4a1fd9d61902fe7ac5721a..18a594436eb82d3e51e4687dd6415ee5ea93bbd3 100644 --- a/Code/Mantid/Framework/Kernel/test/StdoutChannelTest.h +++ b/Code/Mantid/Framework/Kernel/test/StdoutChannelTest.h @@ -34,8 +34,8 @@ public: // Redirect cout to buffer or any other ostream std::cout.rdbuf(obuffer.rdbuf()); std::clog.rdbuf(lbuffer.rdbuf()); - //root logger - Logger & log(Logger::get("")); + //root logger has empty name + Logger log(""); //Test null channel first Poco::AutoPtr<Poco::NullChannel> nullChannel(new Poco::NullChannel);