From e77de5d685ae441f72920f0e04d9887ee958745a Mon Sep 17 00:00:00 2001
From: Eric Tulla <tulla@lindenlab.com>
Date: Wed, 14 May 2008 21:37:13 +0000
Subject: [PATCH] Result of svn merge -r 87455:87538
 $SVN/branches/tulla/vc3-merge . Passed QA as part of QAR-491.

---
 indra/llcommon/llapr.cpp                  |  12 +-
 indra/llcommon/llerror.cpp                |  69 ++-
 indra/llcommon/llerror.h                  |  82 ++-
 indra/llcommon/lltimer.cpp                |   5 +-
 indra/llcommon/lltimer.h                  |   4 +-
 indra/llmath/lloctree.h                   |   4 +-
 indra/llmessage/llassetstorage.cpp        |   2 +-
 indra/llmessage/llhttpnode.cpp            |   4 +-
 indra/llmessage/llmessageconfig.cpp       |  22 +-
 indra/llmessage/llxfermanager.cpp         |   4 +-
 indra/llmessage/message.cpp               | 268 +++++----
 indra/llmessage/net.cpp                   |  22 +-
 indra/llrender/llfontgl.cpp               |   4 +-
 indra/llui/llfloater.cpp                  |  20 +-
 indra/llvfs/lldir.cpp                     |  30 +-
 indra/llvfs/llvfs.cpp                     |  45 +-
 indra/llwindow/lldxhardware.cpp           |  21 +-
 indra/llwindow/llwindowmacosx.cpp         |  62 +-
 indra/llwindow/llwindowwin32.cpp          | 125 ++--
 indra/llxml/llcontrol.cpp                 |   4 +-
 indra/newview/app_settings/cmd_line.xml   | 670 +++++++++++-----------
 indra/newview/app_settings/logcontrol.xml |  47 ++
 indra/newview/app_settings/settings.xml   |  11 +
 indra/newview/llappviewer.cpp             | 131 +++--
 indra/newview/llappviewer.h               |   9 +-
 indra/newview/llappviewermacosx.cpp       |  13 +-
 indra/newview/llappviewerwin32.cpp        |  36 +-
 indra/newview/lldrawable.cpp              |   2 +-
 indra/newview/llfeaturemanager.cpp        |  58 +-
 indra/newview/llpanellogin.h              |   1 +
 indra/newview/llstartup.cpp               | 156 ++---
 indra/newview/lltexturecache.cpp          |  26 +-
 indra/newview/llviewerjointmesh.cpp       |   6 +-
 indra/newview/llviewermenu.cpp            |   2 +
 indra/newview/llviewermessage.cpp         | 221 +++----
 indra/newview/llviewerregion.cpp          |   8 +-
 indra/newview/llviewerthrottle.cpp        |   4 +-
 indra/newview/llviewerwindow.cpp          |  12 +-
 indra/newview/llvoiceclient.cpp           | 222 +++----
 indra/newview/llwatchdog.cpp              | 193 +++++++
 indra/newview/llwatchdog.h                |  95 +++
 indra/newview/llwaterparammanager.cpp     |   6 +-
 indra/newview/llwindebug.cpp              | 154 +++--
 indra/newview/llwindebug.h                |  30 +-
 indra/newview/llwlparammanager.cpp        |   8 +-
 indra/newview/llworld.cpp                 |   6 +
 indra/newview/llxmlrpctransaction.cpp     |   8 +-
 47 files changed, 1715 insertions(+), 1229 deletions(-)
 create mode 100644 indra/newview/app_settings/logcontrol.xml
 create mode 100644 indra/newview/llwatchdog.cpp
 create mode 100644 indra/newview/llwatchdog.h

diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 5e6dfd975e5..5be3919898d 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -54,7 +54,7 @@ void ll_init_apr()
 
 void ll_cleanup_apr()
 {
-	llinfos << "Cleaning up APR" << llendl;
+	LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
 
 	if (gLogMutexp)
 	{
@@ -118,7 +118,7 @@ bool ll_apr_warn_status(apr_status_t status)
 	if(APR_SUCCESS == status) return false;
 #ifndef LL_WINDOWS
 	char buf[MAX_STRING];	/* Flawfinder: ignore */
-	llwarns << "APR: " << apr_strerror(status, buf, MAX_STRING) << llendl;
+	LL_WARNS_ONCE("APR") << "APR: " << apr_strerror(status, buf, MAX_STRING) << LL_ENDL;
 #endif
 	return true;
 }
@@ -294,7 +294,7 @@ bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool)
 	s = apr_file_remove(filename.c_str(), pool);
 	if (s != APR_SUCCESS)
 	{
-		lldebugs << "ll_apr_file_remove failed on file: " << filename << llendl;
+		LL_DEBUGS("APR") << "ll_apr_file_remove failed on file: " << filename << LL_ENDL;
 		ll_apr_warn_status(s);
 		return false;
 	}
@@ -308,7 +308,7 @@ bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_p
 	s = apr_file_rename(filename.c_str(), newname.c_str(), pool);
 	if (s != APR_SUCCESS)
 	{
-		lldebugs << "ll_apr_file_rename failed on file: " << filename << llendl;
+		LL_DEBUGS("APR") << "ll_apr_file_rename failed on file: " << filename << LL_ENDL;
 		ll_apr_warn_status(s);
 		return false;
 	}
@@ -365,7 +365,7 @@ bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool)
 	s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool);
 	if (s != APR_SUCCESS)
 	{
-		lldebugs << "ll_apr_dir_make failed on file: " << dirname << llendl;
+		LL_DEBUGS("APR") << "ll_apr_dir_make failed on file: " << dirname << LL_ENDL;
 		ll_apr_warn_status(s);
 		return false;
 	}
@@ -379,7 +379,7 @@ bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool)
 	s = apr_file_remove(dirname.c_str(), pool);
 	if (s != APR_SUCCESS)
 	{
-		lldebugs << "ll_apr_dir_remove failed on file: " << dirname << llendl;
+		LL_DEBUGS("APR") << "ll_apr_dir_remove failed on file: " << dirname << LL_ENDL;
 		ll_apr_warn_status(s);
 		return false;
 	}
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 13bf368334c..e635011941b 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -408,6 +408,8 @@ namespace LLError
 		LevelMap functionLevelMap;
 		LevelMap classLevelMap;
 		LevelMap fileLevelMap;
+		LevelMap tagLevelMap;
+		std::map<std::string, unsigned int> uniqueLogMessages;
 		
 		LLError::FatalFunction crashFunction;
 		LLError::TimeFunction timeFunction;
@@ -494,11 +496,17 @@ namespace LLError
 namespace LLError
 {
 	CallSite::CallSite(ELevel level,
-					const char* file, int line,
-					const std::type_info& class_info, const char* function)
+					const char* file,
+					int line,
+					const std::type_info& class_info, 
+					const char* function, 
+					const char* broadTag, 
+					const char* narrowTag,
+					bool printOnce)
 		: mLevel(level), mFile(file), mLine(line),
 		  mClassInfo(class_info), mFunction(function),
-		  mCached(false), mShouldLog(false)
+		  mCached(false), mShouldLog(false), 
+		  mBroadTag(broadTag), mNarrowTag(narrowTag), mPrintOnce(printOnce)
 		{ }
 
 
@@ -552,6 +560,15 @@ namespace
 #endif
 
 		LogControlFile& e = LogControlFile::fromDirectory(dir);
+
+		// NOTE: We want to explicitly load the file before we add it to the event timer
+		// that checks for changes to the file.  Else, we're not actually loading the file yet,
+		// and most of the initialization happens without any attention being paid to the
+		// log control file.  Not to mention that when it finally gets checked later,
+		// all log statements that have been evaluated already become dirty and need to be
+		// evaluated for printing again.  So, make sure to call checkAndReload()
+		// before addToEventTimer().
+		e.checkAndReload();
 		e.addToEventTimer();
 	}
 }
@@ -625,6 +642,14 @@ namespace LLError
 		g.invalidateCallSites();
 		s.fileLevelMap[file_name] = level;
 	}
+
+	void setTagLevel(const std::string& tag_name, ELevel level)
+	{
+		Globals& g = Globals::get();
+		Settings& s = Settings::get();
+		g.invalidateCallSites();
+		s.tagLevelMap[tag_name] = level;
+	}
 }
 
 namespace {
@@ -674,6 +699,8 @@ namespace LLError
 		s.functionLevelMap.clear();
 		s.classLevelMap.clear();
 		s.fileLevelMap.clear();
+		s.tagLevelMap.clear();
+		s.uniqueLogMessages.clear();
 		
 		setPrintLocation(config["print-location"]);
 		setDefaultLevel(decodeLevel(config["default-level"]));
@@ -689,6 +716,7 @@ namespace LLError
 			setLevels(s.functionLevelMap,	entry["functions"],	level);
 			setLevels(s.classLevelMap,		entry["classes"],	level);
 			setLevels(s.fileLevelMap,		entry["files"],		level);
+			setLevels(s.tagLevelMap,		entry["tags"],		level);
 		}
 	}
 }
@@ -850,7 +878,7 @@ namespace {
 			return false;
 		}
 		
-		level = i->second;
+			level = i->second;
 		return true;
 	}
 	
@@ -929,9 +957,15 @@ namespace LLError
 
 		ELevel compareLevel = s.defaultLevel;
 
-		checkLevelMap(s.functionLevelMap, function_name, compareLevel)
+		// The most specific match found will be used as the log level,
+		// since the computation short circuits.
+		// So, in increasing order of importance:
+		// Default < Broad Tag < File < Class < Function < Narrow Tag
+		((site.mNarrowTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mNarrowTag, compareLevel) : false)
+		|| checkLevelMap(s.functionLevelMap, function_name, compareLevel)
 		|| checkLevelMap(s.classLevelMap, class_name, compareLevel)
-		|| checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel);
+		|| checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel)
+		|| ((site.mBroadTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mBroadTag, compareLevel) : false);
 
 		site.mCached = true;
 		g.addCallSite(site);
@@ -1018,6 +1052,29 @@ namespace LLError
 	#endif
 			prefix << site.mFunction << ": ";
 		}
+
+		if (site.mPrintOnce)
+		{
+			std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
+			if (messageIter != s.uniqueLogMessages.end())
+			{
+				messageIter->second++;
+				unsigned int num_messages = messageIter->second;
+				if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
+				{
+					prefix << "ONCE (" << num_messages << "th time seen): ";
+				} 
+				else
+				{
+					return;
+				}
+			}
+			else 
+			{
+				prefix << "ONCE: ";
+				s.uniqueLogMessages[message] = 1;
+			}
+		}
 		
 		prefix << message;
 		message = prefix.str();
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index ae41cd52449..13fb2bcebe0 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -45,23 +45,23 @@
 	
 	Code can log messages with constuctions like this:
 	
-		llinfos << "request to fizzbip agent " << agent_id
-			<< " denied due to timeout" << llendl;
+		LL_INFOS("StringTag") << "request to fizzbip agent " << agent_id
+			<< " denied due to timeout" << LL_ENDL;
 		
 	Messages can be logged to one of four increasing levels of concern,
 	using one of four "streams":
 
-		lldebugs	- debug messages that are normally supressed
-		llinfos		- informational messages that are normall shown
-		llwarns		- warning messages that singal a problem
-		llerrs		- error messages that are major, unrecoverable failures
+		LL_DEBUGS("StringTag")	- debug messages that are normally supressed
+		LL_INFOS("StringTag")	- informational messages that are normall shown
+		LL_WARNS("StringTag")	- warning messages that singal a problem
+		LL_ERRS("StringTag")	- error messages that are major, unrecoverable failures
 		
-	The later (llerrs) automatically crashes the process after the message
+	The later (LL_ERRS("StringTag")) automatically crashes the process after the message
 	is logged.
 	
 	Note that these "streams" are actually #define magic.  Rules for use:
 		* they cannot be used as normal streams, only to start a message
-		* messages written to them MUST be terminated with llendl
+		* messages written to them MUST be terminated with LL_ENDL
 		* between the opening and closing, the << operator is indeed
 		  writing onto a std::ostream, so all conversions and stream
 		  formating are available
@@ -85,7 +85,7 @@
 		{
 			if (i > 100)
 			{
-				llwanrs << "called with a big value for i: " << i << llendl; 
+				LL_WARNS("FooBarTag") << "called with a big value for i: " << i << LL_ENDL; 
 			}
 			...
 		}
@@ -100,7 +100,7 @@
 	
 	Lastly, logging is now very efficient in both compiled code and execution
 	when skipped.  There is no need to wrap messages, even debugging ones, in
-	#ifdef _DEBUG constructs.  lldebugs messages are compiled into all builds,
+	#ifdef _DEBUG constructs.  LL_DEBUGS("StringTag") messages are compiled into all builds,
 	even release.  Which means you can use them to help debug even when deployed
 	to a real grid.
 */
@@ -144,7 +144,7 @@ namespace LLError
 		// intended for public use.
 	public:
 		CallSite(ELevel, const char* file, int line,
-				const std::type_info& class_info, const char* function);
+				const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce);
 						
 		bool shouldLog()
 			{ return mCached ? mShouldLog : Log::shouldLog(*this); }
@@ -156,9 +156,12 @@ namespace LLError
 		// these describe the call site and never change
 		const ELevel			mLevel;
 		const char* const		mFile;
-		const int				mLine;
-		const std::type_info&	mClassInfo;
+		const int			mLine;
+		const std::type_info&   	mClassInfo;
 		const char* const		mFunction;
+		const char* const		mBroadTag;
+		const char* const		mNarrowTag;
+		const bool			mPrintOnce;
 		
 		// these implement a cache of the call to shouldLog()
 		bool mCached;
@@ -200,39 +203,66 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
 	See top of file for common usage.	
 */
 
-#define lllog(level) \
+#define lllog(level, broadTag, narrowTag, once) \
 	{ \
 		static LLError::CallSite _site( \
-			level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__);\
+			level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\
 		if (_site.shouldLog()) \
 		{ \
 			std::ostringstream* _out = LLError::Log::out(); \
 			(*_out)
-	
+
+// DEPRECATED: Don't call directly, use LL_ENDL instead, which actually looks like a macro
 #define llendl \
 			LLError::End(); \
 			LLError::Log::flush(_out, _site); \
 		} \
 	}
 
-#define llinfos		lllog(LLError::LEVEL_INFO)
-#define lldebugs	lllog(LLError::LEVEL_DEBUG)
-#define llwarns		lllog(LLError::LEVEL_WARN)
-#define llerrs		lllog(LLError::LEVEL_ERROR)
-
+// DEPRECATED: Use the new macros that allow tags and *look* like macros.
+#define lldebugs	lllog(LLError::LEVEL_DEBUG, NULL, NULL, false)
+#define llinfos		lllog(LLError::LEVEL_INFO, NULL, NULL, false)
+#define llwarns		lllog(LLError::LEVEL_WARN, NULL, NULL, false)
+#define llerrs		lllog(LLError::LEVEL_ERROR, NULL, NULL, false)
 #define llcont		(*_out)
+
+// NEW Macros for debugging, allow the passing of a string tag
+
+// One Tag
+#define LL_DEBUGS(broadTag)	lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false)
+#define LL_INFOS(broadTag)	lllog(LLError::LEVEL_INFO, broadTag, NULL, false)
+#define LL_WARNS(broadTag)	lllog(LLError::LEVEL_WARN, broadTag, NULL, false)
+#define LL_ERRS(broadTag)	lllog(LLError::LEVEL_ERROR, broadTag, NULL, false)
+// Two Tags
+#define LL_DEBUGS2(broadTag, narrowTag)	lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false)
+#define LL_INFOS2(broadTag, narrowTag)	lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false)
+#define LL_WARNS2(broadTag, narrowTag)	lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false)
+#define LL_ERRS2(broadTag, narrowTag)	lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false)
+
+// Only print the log message once (good for warnings or infos that would otherwise
+// spam the log file over and over, such as tighter loops).
+#define LL_DEBUGS_ONCE(broadTag)	lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true)
+#define LL_INFOS_ONCE(broadTag)	lllog(LLError::LEVEL_INFO, broadTag, NULL, true)
+#define LL_WARNS_ONCE(broadTag)	lllog(LLError::LEVEL_WARN, broadTag, NULL, true)
+#define LL_DEBUGS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true)
+#define LL_INFOS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true)
+#define LL_WARNS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true)
+
+#define LL_ENDL llendl
+#define LL_CONT	(*_out)
+
 	/*
 		Use this construct if you need to do computation in the middle of a
 		message:
 		
-			llinfos << "the agent " << agend_id;
+			LL_INFOS("AgentGesture") << "the agent " << agend_id;
 			switch (f)
 			{
-				case FOP_SHRUGS:	llcont << "shrugs";				break;
-				case FOP_TAPS:		llcont << "points at " << who;	break;
-				case FOP_SAYS:		llcont << "says " << message;	break;
+				case FOP_SHRUGS:	LL_CONT << "shrugs";				break;
+				case FOP_TAPS:		LL_CONT << "points at " << who;	break;
+				case FOP_SAYS:		LL_CONT << "says " << message;	break;
 			}
-			llcont << " for " << t << " seconds" << llendl;
+			LL_CONT << " for " << t << " seconds" << LL_ENDL;
 		
 		Such computation is done iff the message will be logged.
 	*/
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index cf984e4fe27..af89a09d2fd 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -334,7 +334,7 @@ void  LLTimer::setTimerExpirySec(F32 expiration)
 		+ (U64)((F32)(expiration * gClockFrequency));
 }
 
-F32 LLTimer::getRemainingTimeF32()
+F32 LLTimer::getRemainingTimeF32() const
 {
 	U64 cur_ticks = get_clock_count();
 	if (cur_ticks > mExpirationTicks)
@@ -359,7 +359,7 @@ BOOL  LLTimer::checkExpirationAndReset(F32 expiration)
 }
 
 
-BOOL  LLTimer::hasExpired()
+BOOL  LLTimer::hasExpired() const
 {
 	return (get_clock_count() >= mExpirationTicks)
 		? TRUE : FALSE;
@@ -561,3 +561,4 @@ void LLEventTimer::updateClass()
 	}
 }
 
+
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index 113eb1e9e31..57f9e23e7aa 100644
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -87,11 +87,11 @@ class LLTimer
 	void setLastClockCount(U64 current_count);		// Sets the timer so that the next elapsed call will be relative to this time
 	void setTimerExpirySec(F32 expiration);
 	BOOL checkExpirationAndReset(F32 expiration);
-	BOOL hasExpired();
+	BOOL hasExpired() const;
 	F32 getElapsedTimeAndResetF32();	// Returns elapsed time in seconds with reset
 	F64 getElapsedTimeAndResetF64();
 
-	F32 getRemainingTimeF32();
+	F32 getRemainingTimeF32() const;
 
 	static BOOL knownBadTimer();
 
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index 998d19d58b1..80211fb0a2d 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -38,9 +38,9 @@
 #include <set>
 
 #ifdef LL_RELEASE_FOR_DOWNLOAD
-#define OCT_ERRS llwarns
+#define OCT_ERRS LL_WARNS("OctreeErrors")
 #else
-#define OCT_ERRS llerrs
+#define OCT_ERRS LL_ERRS("OctreeErrors")
 #endif
 
 #define LL_OCTREE_PARANOIA_CHECK 0
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 1f4ea70d957..2c8e7ce8a64 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -318,7 +318,7 @@ LLAssetStorage::~LLAssetStorage()
 
 void LLAssetStorage::setUpstream(const LLHost &upstream_host)
 {
-	llinfos << "AssetStorage: Setting upstream provider to " << upstream_host << llendl;
+	LL_DEBUGS("AppInit") << "AssetStorage: Setting upstream provider to " << upstream_host << LL_ENDL;
 	
 	mUpstreamHost = upstream_host;
 }
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index b82bd65d2ea..196aa5f8cfd 100644
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -426,8 +426,8 @@ void LLHTTPRegistrar::buildAllServices(LLHTTPNode& root)
     FactoryMap::const_iterator end = map.end();
     for (; i != end; ++i)
     {
-		llinfos << "LLHTTPRegistrar::buildAllServices adding node for path "
-			<< i->first << llendl;
+		LL_DEBUGS("AppInit") << "LLHTTPRegistrar::buildAllServices adding node for path "
+			<< i->first << LL_ENDL;
 		
         root.addNode(i->first, i->second->build());
     }
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp
index ed51019a220..259daada770 100644
--- a/indra/llmessage/llmessageconfig.cpp
+++ b/indra/llmessage/llmessageconfig.cpp
@@ -101,15 +101,15 @@ void LLMessageConfigFile::loadFile()
         
         if (file.is_open())
         {
-			llinfos << "Loading message.xml file at " << filename() << llendl;
+			LL_DEBUGS("AppInit") << "Loading message.xml file at " << filename() << LL_ENDL;
             LLSDSerialize::fromXML(data, file);
         }
 
         if (data.isUndefined())
         {
-            llinfos << "LLMessageConfigFile::loadFile: file missing,"
+            LL_INFOS("AppInit") << "LLMessageConfigFile::loadFile: file missing,"
 				" ill-formed, or simply undefined; not changing the"
-				" file" << llendl;
+				" file" << LL_ENDL;
             return;
         }
     }
@@ -157,15 +157,15 @@ void LLMessageConfigFile::loadCapBans(const LLSD& data)
     LLSD bans = data["capBans"];
     if (!bans.isMap())
     {
-        llinfos << "LLMessageConfigFile::loadCapBans: missing capBans section"
-            << llendl;
+        LL_INFOS("AppInit") << "LLMessageConfigFile::loadCapBans: missing capBans section"
+            << LL_ENDL;
         return;
     }
     
 	mCapBans = bans;
     
-    llinfos << "LLMessageConfigFile::loadCapBans: "
-        << bans.size() << " ban tests" << llendl;
+    LL_DEBUGS("AppInit") << "LLMessageConfigFile::loadCapBans: "
+        << bans.size() << " ban tests" << LL_ENDL;
 }
 
 void LLMessageConfigFile::loadMessageBans(const LLSD& data)
@@ -173,8 +173,8 @@ void LLMessageConfigFile::loadMessageBans(const LLSD& data)
     LLSD bans = data["messageBans"];
     if (!bans.isMap())
     {
-        llinfos << "LLMessageConfigFile::loadMessageBans: missing messageBans section"
-            << llendl;
+        LL_INFOS("AppInit") << "LLMessageConfigFile::loadMessageBans: missing messageBans section"
+            << LL_ENDL;
         return;
     }
     
@@ -198,8 +198,8 @@ void LLMessageConfig::initClass(const std::string& server_name,
 	sServerName = server_name;
 	sConfigDir = config_dir;
 	(void) LLMessageConfigFile::instance();
-	llinfos << "LLMessageConfig::initClass config file "
-			<< config_dir << "/" << messageConfigFileName << llendl;
+	LL_DEBUGS("AppInit") << "LLMessageConfig::initClass config file "
+			<< config_dir << "/" << messageConfigFileName << LL_ENDL;
 }
 
 //static
diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp
index a612e181cd3..fc75b3ae75c 100644
--- a/indra/llmessage/llxfermanager.cpp
+++ b/indra/llmessage/llxfermanager.cpp
@@ -143,8 +143,8 @@ void LLXferManager::setAckThrottleBPS(const F32 bps)
 
 	// Set
 	F32 actual_rate = llmax(min_bps*1.1f, bps);
-	llinfos << "LLXferManager ack throttle min rate: " << min_bps << llendl;
-	llinfos << "LLXferManager ack throttle actual rate: " << actual_rate << llendl;
+	LL_DEBUGS("AppInit") << "LLXferManager ack throttle min rate: " << min_bps << LL_ENDL;
+	LL_DEBUGS("AppInit") << "LLXferManager ack throttle actual rate: " << actual_rate << LL_ENDL;
 	mAckThrottle.setRate(actual_rate);
 }
 
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 26678d61ccf..04f61c53d72 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -120,7 +120,7 @@ namespace
 			// don't spam when agent communication disconnected already
 			if (status != 410)
 			{
-				llwarns << "error status " << status
+				LL_WARNS("Messaging") << "error status " << status
 						<< " for message " << mMessageName
 						<< " reason " << reason << llendl;
 			}
@@ -176,7 +176,7 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
 		  gMessageSystem->isTrustedMessage(name)))
 		 && !gMessageSystem->isTrustedSender(LLHost(sender)))
 	{
-		llwarns << "trusted message POST to /trusted-message/" 
+		LL_WARNS("Messaging") << "trusted message POST to /trusted-message/" 
 				<< name << " from unknown or untrusted sender "
 				<< sender << llendl;
 		response->status(403, "Unknown or untrusted sender");
@@ -326,14 +326,14 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port,
 		mbError = TRUE;
 		mErrorCode = error;
 	}
-	//llinfos <<  << "*** port: " << mPort << llendl;
+//	LL_DEBUGS("Messaging") <<  << "*** port: " << mPort << llendl;
 
 	//
 	// Create the data structure that we can poll on
 	//
 	if (!gAPRPoolp)
 	{
-		llerrs << "No APR pool before message system initialization!" << llendl;
+		LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl;
 		ll_init_apr();
 	}
 	apr_socket_t *aprSocketp = NULL;
@@ -369,7 +369,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
 {
 	if(!filename)
 	{
-		llerrs << "No template filename specified" << llendl;
+		LL_ERRS("Messaging") << "No template filename specified" << llendl;
 		mbError = TRUE;
 		return;
 	}
@@ -377,7 +377,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
 	std::string template_body;
 	if(!_read_file_into_string(template_body, filename))
 	{
-		llwarns << "Failed to open template: " << filename << llendl;
+		LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl;
 		mbError = TRUE;
 		return;
 	}
@@ -588,7 +588,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 			// Ones that are non-zero but below the minimum packet size are worrisome.
 			if (receive_size > 0)
 			{
-				llwarns << "Invalid (too short) packet discarded " << receive_size << llendl;
+				LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl;
 				callExceptionFunc(MX_PACKET_TOO_SHORT);
 			}
 			// no data in packet receive buffer
@@ -612,7 +612,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 				{
 					// mal-formed packet. ignore it and continue with
 					// the next one
-					llwarns << "Malformed packet received. Packet size "
+					LL_WARNS("Messaging") << "Malformed packet received. Packet size "
 						<< receive_size << " with invalid no. of acks " << acks
 						<< llendl;
 					valid_packet = FALSE;
@@ -642,7 +642,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 					memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/
 					     sizeof(TPACKETID));
 					packet_id = ntohl(mem_id);
-					//llinfos << "got ack: " << packet_id << llendl;
+					//LL_INFOS("Messaging") << "got ack: " << packet_id << llendl;
 					cdp->ackReliablePacket(packet_id);
 				}
 				if (!cdp->getUnackedPacketCount())
@@ -671,7 +671,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 						// TESTING CODE
 						//if(mCircuitInfo.mCurrentCircuit->mHost != host)
 						//{
-						//	llwarns << "DISCARDED PACKET HOST MISMATCH! HOST: "
+						//	LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: "
 						//			<< host << " CIRCUIT: "
 						//			<< mCircuitInfo.mCurrentCircuit->mHost
 						//			<< llendl;
@@ -681,7 +681,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 						cdp->collectRAck(mCurrentRecvPacketID);
 					}
 								 
-					//llinfos << "Discarding duplicate resend from " << host << llendl;
+					LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl;
 					if(mVerboseLog)
 					{
 						std::ostringstream str;
@@ -693,7 +693,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 							<< " resent "
 							<< ((acks > 0) ? "acks" : "")
 							<< " DISCARD DUPLICATE";
-						llinfos << str.str() << llendl;
+						LL_INFOS("Messaging") << str.str() << llendl;
 					}
 					mPacketsIn++;
 					valid_packet = FALSE;
@@ -740,7 +740,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 				valid_packet &&
 				mTemplateMessageReader->isBanned(cdp && cdp->getTrusted()))
 			{
-				llwarns << "LLMessageSystem::checkMessages "
+				LL_WARNS("Messaging") << "LLMessageSystem::checkMessages "
 					<< "received banned message "
 					<< mTemplateMessageReader->getMessageName()
 					<< " from "
@@ -764,7 +764,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 			if (valid_packet)
 			{
 				// enable this for output of message names
-				//llinfos << "< \"" << mTemplateMessageReader->getMessageName()
+				//LL_INFOS("Messaging") << "< \"" << mTemplateMessageReader->getMessageName()
 						//<< "\"" << llendl;
 
 				/* Code for dumping the complete contents of a message.  Keep for future use in optimizing messages.
@@ -773,23 +773,23 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 					static char* object_update = LLMessageStringTable::getInstance()->getString("ObjectUpdate");
 					if(object_update == mTemplateMessageReader->getMessageName() )
 					{
-						llinfos << "ObjectUpdate:" << llendl;
+						LL_INFOS("Messaging") << "ObjectUpdate:" << llendl;
 						U32 i;
-						llinfos << "    Zero Encoded: " << zero_unexpanded_size << llendl;
+						LL_INFOS("Messaging") << "    Zero Encoded: " << zero_unexpanded_size << llendl;
 						for( i = 0; i<zero_unexpanded_size; i++ )
 						{
-							llinfos << "     " << i << ": " << (U32) zero_unexpanded_buffer[i] << llendl;
+							LL_INFOS("Messaging") << "     " << i << ": " << (U32) zero_unexpanded_buffer[i] << llendl;
 						}
-						llinfos << "" << llendl;
+						LL_INFOS("Messaging") << "" << llendl;
 
-						llinfos << "    Zero Unencoded: " << receive_size << llendl;
+						LL_INFOS("Messaging") << "    Zero Unencoded: " << receive_size << llendl;
 						for( i = 0; i<receive_size; i++ )
 						{
-							llinfos << "     " << i << ": " << (U32) buffer[i] << llendl;
+							LL_INFOS("Messaging") << "     " << i << ": " << (U32) buffer[i] << llendl;
 						}
-						llinfos << "" << llendl;
+						LL_INFOS("Messaging") << "" << llendl;
 
-						llinfos << "    Blocks and variables: " << llendl;
+						LL_INFOS("Messaging") << "    Blocks and variables: " << llendl;
 						S32 byte_count = 0;
 						for (LLMessageTemplate::message_block_map_t::iterator
 								 iter = mCurrentRMessageTemplate->mMemberBlocks.begin(),
@@ -807,7 +807,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 								
 								if( getNumberOfBlocksFast( block_name ) < 1 )
 								{
-									llinfos << var_name << " has no blocks" << llendl;
+									LL_INFOS("Messaging") << var_name << " has no blocks" << llendl;
 								}
 								for( S32 blocknum = 0; blocknum < getNumberOfBlocksFast( block_name ); blocknum++ )
 								{
@@ -820,7 +820,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 									if (!msg_block_data)
 									{
 										sprintf(errmsg, "Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName);
-										llerrs << errmsg << llendl;
+										LL_ERRS("Messaging") << errmsg << llendl;
 									}
 
 									LLMsgVarData vardata = msg_block_data->mMemberVarData[vnamep];
@@ -828,7 +828,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 									if (!vardata.getName())
 									{
 										sprintf(errmsg, "Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep);
-										llerrs << errmsg << llendl;
+										LL_ERRS("Messaging") << errmsg << llendl;
 									}
 
 									const S32 vardata_size = vardata.getSize();
@@ -837,17 +837,17 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 										for( i = 0; i < vardata_size; i++ )
 										{
 											byte_count++;
-											llinfos << block_name << " " << var_name << " [" << blocknum << "][" << i << "]= " << (U32)(((U8*)vardata.getData())[i]) << llendl;
+											LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "][" << i << "]= " << (U32)(((U8*)vardata.getData())[i]) << llendl;
 										}
 									}
 									else
 									{
-										llinfos << block_name << " " << var_name << " [" << blocknum << "] 0 bytes" << llendl;
+										LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "] 0 bytes" << llendl;
 									}
 								}
 							}
 						}
-						llinfos << "Byte count =" << byte_count << llendl;
+						LL_INFOS("Messaging") << "Byte count =" << byte_count << llendl;
 					}
 				}
 				*/
@@ -871,7 +871,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 			{
 				if (mbProtected  && (!cdp))
 				{
-					llwarns << "Invalid Packet from invalid circuit " << host << llendl;
+					LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl;
 					mOffCircuitPackets++;
 				}
 				else
@@ -944,7 +944,7 @@ void LLMessageSystem::processAcks()
 
 		if (!mDenyTrustedCircuitSet.empty())
 		{
-			llinfos << "Sending queued DenyTrustedCircuit messages." << llendl;
+			LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl;
 			for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit)
 			{
 				reallySendDenyTrustedCircuit(*hostit);
@@ -1176,7 +1176,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
 	{
 		// These messages aren't really unreliable, they just weren't
 		// explicitly sent as reliable, so they don't have a callback
-//		llwarns << "LLMessageSystem::sendMessage: Sending unreliable "
+//		LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable "
 //				<< mMessageBuilder->getMessageName() << " message via HTTP"
 //				<< llendl;
 		return new LLFnPtrResponder(
@@ -1213,10 +1213,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			// yup! don't send packets to an unknown circuit
 			if(mVerboseLog)
 			{
-				llinfos << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t"
+				LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t"
 						<< mMessageBuilder->getMessageName() << llendl;
 			}
-			llwarns << "sendMessage - Trying to send "
+			LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send "
 					<< mMessageBuilder->getMessageName() << " on unknown circuit "
 					<< host << llendl;
 			return 0;
@@ -1236,10 +1236,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			// nope. don't send to dead circuits
 			if(mVerboseLog)
 			{
-				llinfos << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t"
+				LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t"
 						<< mMessageBuilder->getMessageName() << llendl;
 			}
-			llwarns << "sendMessage - Trying to send message "
+			LL_WARNS("Messaging") << "sendMessage - Trying to send message "
 					<< mMessageBuilder->getMessageName() << " to dead circuit "
 					<< host << llendl;
 			return 0;
@@ -1283,7 +1283,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 		if((mMessageBuilder->getMessageName() != _PREHASH_ChildAgentUpdate)
 		   && (mMessageBuilder->getMessageName() != _PREHASH_SendXferPacket))
 		{
-			llwarns << "sendMessage - Trying to send "
+			LL_WARNS("Messaging") << "sendMessage - Trying to send "
 					<< ((buffer_length > 4000) ? "EXTRA " : "")
 					<< "BIG message " << mMessageBuilder->getMessageName() << " - "
 					<< buffer_length << llendl;
@@ -1348,7 +1348,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 				// append_acout_count is incorrect or that
 				// MAX_BUFFER_SIZE has fallen below MTU which is bad
 				// and probably programmer error.
-			    llerrs << "Buffer packing failed due to size.." << llendl;
+			    LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl;
 			}
 		}
 
@@ -1389,13 +1389,9 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			std::ostream_iterator<TPACKETID> append(str, " ");
 			std::copy(acks.begin(), acks.end(), append);
 		}
-		llinfos << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << llendl;
 	}
 
-	/*lldebugst(LLERR_MESSAGE) << "MessageSent at: " << (S32)totalTime() 
-							 << "," << mMessageBuilder->getMessageName()
-							 << " to " << host 
-							 << llendl;*/
 
 	mPacketsOut++;
 	mBytesOut += buffer_length;
@@ -1417,7 +1413,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
 			<< nullToEmpty(mMessageReader->getMessageName())
 			<< (recv_reliable ? " reliable" : "")
  			<< " REJECTED";
-		llinfos << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << llendl;
 	}
 	// nope!
 	// cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl;
@@ -1425,7 +1421,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
 	// Keep track of rejected messages as well
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
-		llwarns << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
 	}
 	else
 	{
@@ -1444,13 +1440,13 @@ S32 LLMessageSystem::sendMessage(
 {
 	if (!(host.isOk()))
 	{
-		llwarns << "trying to send message to invalid host"	<< llendl;
+		LL_WARNS("Messaging") << "trying to send message to invalid host"	<< llendl;
 		return 0;
 	}
 	newMessage(name);	
 	if (mMessageBuilder != mLLSDMessageBuilder)
 	{
-		llwarns << "trying to send llsd message when builder is not LLSD!"
+		LL_WARNS("Messaging") << "trying to send llsd message when builder is not LLSD!"
 				<< llendl;
 		return 0;
 	}
@@ -1466,7 +1462,7 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host )
 	// if it's received on a trusted circuit. JC
 	if (strcmp(mMessageReader->getMessageName(), "RequestTrustedCircuit"))
 	{
-		llwarns << "Received trusted message on untrusted circuit. "
+		LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. "
 				<< "Will reply with deny. "
 				<< "Message: " << nullToEmpty(mMessageReader->getMessageName())
 				<< " Host: " << host << llendl;
@@ -1474,7 +1470,7 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host )
 
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
-		llwarns << "got more than " << MAX_MESSAGE_COUNT_NUM
+		LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM
 			<< " packets without clearing counts"
 			<< llendl;
 	}
@@ -1494,7 +1490,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
 {
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
-		llwarns << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
 	}
 	else
 	{
@@ -1523,7 +1519,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
 			<< (recv_reliable ? " reliable" : "")
 			<< (recv_resent ? " resent" : "")
 			<< (recv_acks ? " acks" : "");
-		llinfos << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << llendl;
 	}
 }
 
@@ -1533,48 +1529,48 @@ void LLMessageSystem::sanityCheck()
 
 //	if (!mCurrentRMessageData)
 //	{
-//		llerrs << "mCurrentRMessageData is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl;
 //	}
 
 //	if (!mCurrentRMessageTemplate)
 //	{
-//		llerrs << "mCurrentRMessageTemplate is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl;
 //	}
 
 //	if (!mCurrentRTemplateBlock)
 //	{
-//		llerrs << "mCurrentRTemplateBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl;
 //	}
 
 //	if (!mCurrentRDataBlock)
 //	{
-//		llerrs << "mCurrentRDataBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl;
 //	}
 
 //	if (!mCurrentSMessageData)
 //	{
-//		llerrs << "mCurrentSMessageData is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl;
 //	}
 
 //	if (!mCurrentSMessageTemplate)
 //	{
-//		llerrs << "mCurrentSMessageTemplate is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl;
 //	}
 
 //	if (!mCurrentSTemplateBlock)
 //	{
-//		llerrs << "mCurrentSTemplateBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl;
 //	}
 
 //	if (!mCurrentSDataBlock)
 //	{
-//		llerrs << "mCurrentSDataBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl;
 //	}
 }
 
 void LLMessageSystem::showCircuitInfo()
 {
-	llinfos << mCircuitInfo << llendl;
+	LL_INFOS("Messaging") << mCircuitInfo << llendl;
 }
 
 
@@ -1624,7 +1620,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted)
 
 void LLMessageSystem::disableCircuit(const LLHost &host)
 {
-	llinfos << "LLMessageSystem::disableCircuit for " << host << llendl;
+	LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl;
 	U32 code = gMessageSystem->findCircuitCode( host );
 
 	// Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03
@@ -1637,7 +1633,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 		code_session_map_t::iterator it = mCircuitCodes.find(code);
 		if(it != mCircuitCodes.end())
 		{
-			llinfos << "Circuit " << code << " removed from list" << llendl;
+			LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl;
 			//mCircuitCodes.removeData(code);
 			mCircuitCodes.erase(it);
 		}
@@ -1653,7 +1649,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 			U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF);
 			U32 old_ip = (U32)(ip_port >> 32);
 
-			llinfos << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl;
+			LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl;
 			gMessageSystem->mIPPortToCircuitCode.erase(ip_port);
 		}
 		mCircuitInfo.removeCircuitData(host);
@@ -1663,7 +1659,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 		// Sigh, since we can open circuits which don't have circuit
 		// codes, it's possible for this to happen...
 		
-		llwarns << "Couldn't find circuit code for " << host << llendl;
+		LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl;
 	}
 
 }
@@ -1694,7 +1690,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
 
 	if (!host.isOk())
 	{
-		//llinfos << "checkCircuitBlocked: Unknown circuit " << circuit << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl;
 		return TRUE;
 	}
 
@@ -1705,7 +1701,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
 	}
 	else
 	{
-		llinfos << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl;
+		LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl;
 		return FALSE;
 	}
 }
@@ -1716,7 +1712,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
 
 	if (!host.isOk())
 	{
-		//llinfos << "checkCircuitAlive: Unknown circuit " << circuit << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl;
 		return FALSE;
 	}
 
@@ -1727,7 +1723,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
 	}
 	else
 	{
-		llinfos << "checkCircuitAlive(circuit): Unknown host - " << host << llendl;
+		LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl;
 		return FALSE;
 	}
 }
@@ -1741,7 +1737,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host)
 	}
 	else
 	{
-		//llinfos << "checkCircuitAlive(host): Unknown host - " << host << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl;
 		return FALSE;
 	}
 }
@@ -1891,7 +1887,7 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**)
 	msg->getUUIDFast(_PREHASH_CircuitCode, _PREHASH_SessionID, session_id);
 	if(session_id != msg->getMySessionID())
 	{
-		llwarns << "AssignCircuitCode, bad session id. Expecting "
+		LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting "
 				<< msg->getMySessionID() << " but got " << session_id
 				<< llendl;
 		return;
@@ -1900,11 +1896,11 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**)
 	msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code);
 	if (!code)
 	{
-		llerrs << "Assigning circuit code of zero!" << llendl;
+		LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl;
 	}
 	
 	msg->mOurCircuitCode = code;
-	llinfos << "Circuit code " << code << " assigned." << llendl;
+	LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl;
 }
 */
 
@@ -1928,20 +1924,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id)
 {
 	if(!code)
 	{
-		llwarns << "addCircuitCode: zero circuit code" << llendl;
+		LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl;
 		return false;
 	}
 	code_session_map_t::iterator it = mCircuitCodes.find(code);
 	if(it == mCircuitCodes.end())
 	{
-		llinfos << "New circuit code " << code << " added" << llendl;
+		LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl;
 		//msg->mCircuitCodes[circuit_code] = circuit_code;
 		
 		mCircuitCodes.insert(code_session_map_t::value_type(code, session_id));
 	}
 	else
 	{
-		llinfos << "Duplicate circuit code " << code << " added" << llendl;
+		LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl;
 	}
 	return true;
 }
@@ -1973,7 +1969,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 		if(it == msg->mCircuitCodes.end())
 		{
 			// Whoah, abort!  We don't know anything about this circuit code.
-			llwarns << "UseCircuitCode for " << circuit_code_in
+			LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in
 					<< " received without AddCircuitCode message - aborting"
 					<< llendl;
 			return;
@@ -1985,7 +1981,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 		msg->getUUIDFast(_PREHASH_CircuitCode, _PREHASH_SessionID, session_id);
 		if(session_id != (*it).second)
 		{
-			llwarns << "UseCircuitCode unmatched session id. Got "
+			LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got "
 					<< session_id << " but expected " << (*it).second
 					<< llendl;
 			return;
@@ -2000,7 +1996,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 			if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in))
 			{
 				// Current information is the same as incoming info, ignore
-				llinfos << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl;
+				LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl;
 				return;
 			}
 
@@ -2010,25 +2006,25 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 			msg->mIPPortToCircuitCode.erase(ip_port_old);
 			U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF);
 			U32 old_ip = (U32)(ip_port_old >> 32);
-			llinfos << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl;
+			LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl;
 		}
 
 		if (circuit_code_old)
 		{
 			LLHost cur_host(ip, port);
 
-			llwarns << "Disabling existing circuit for " << cur_host << llendl;
+			LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl;
 			msg->disableCircuit(cur_host);
 			if (circuit_code_old == circuit_code_in)
 			{
-				llwarns << "Asymmetrical circuit to ip/port lookup!" << llendl;
-				llwarns << "Multiple circuit codes for " << cur_host << " probably!" << llendl;
-				llwarns << "Permanently disabling circuit" << llendl;
+				LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl;
+				LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl;
+				LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl;
 				return;
 			}
 			else
 			{
-				llwarns << "Circuit code changed for " << msg->getSender()
+				LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender()
 						<< " from " << circuit_code_old << " to "
 						<< circuit_code_in << llendl;
 			}
@@ -2070,7 +2066,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 		msg->mIPPortToCircuitCode[ip_port_in] = circuit_code_in;
 		msg->mCircuitCodeToIPPort[circuit_code_in] = ip_port_in;
 
-		llinfos << "Circuit code " << circuit_code_in << " from "
+		LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from "
 				<< msg->getSender() << " for agent " << id << " in session "
 				<< session_id << llendl;
 
@@ -2083,7 +2079,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 	}
 	else
 	{
-		llwarns << "Got zero circuit code in use_circuit_code" << llendl;
+		LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl;
 	}
 }
 
@@ -2105,7 +2101,7 @@ void LLMessageSystem::processError(LLMessageSystem* msg, void**)
 	msg->getString("Data", "Message", MTUBYTES, buffer);
 	error_message.assign(buffer);
 
-	llwarns << "Message error from " << msg->getSender() << " - "
+	LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - "
 		<< error_code << " " << error_token << " " << error_id << " \""
 		<< error_system << "\" \"" << error_message << "\"" << llendl;
 }
@@ -2143,7 +2139,7 @@ void LLMessageSystem::dispatch(
 				gMessageSystem->mMessageTemplates.end()) &&
 		!LLMessageConfig::isValidMessage(msg_name))
 	{
-		llwarns << "Ignoring unknown message " << msg_name << llendl;
+		LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl;
 		responsep->notFound("Invalid message name");
 		return;
 	}
@@ -2153,12 +2149,12 @@ void LLMessageSystem::dispatch(
 	const LLHTTPNode* handler =	messageRootNode().traverse(path, context);
 	if (!handler)
 	{
-		llwarns	<< "LLMessageService::dispatch > no handler for "
+		LL_WARNS("Messaging")	<< "LLMessageService::dispatch > no handler for "
 				<< path << llendl;
 		return;
 	}
 	// enable this for output of message names
-	//llinfos << "< \"" << msg_name << "\"" << llendl;
+	//LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl;
 	//lldebugs << "data: " << LLSDNotationStreamer(message) << llendl;	   
 
 	handler->post(responsep, context, message);
@@ -2177,9 +2173,9 @@ static void check_for_unrecognized_messages(
 
 		if (templates.find(name) == templates.end())
 		{
-			llinfos << "    " << type
+			LL_INFOS("AppInit") << "    " << type
 				<< " ban list contains unrecognized message "
-				<< name << llendl;
+				<< name << LL_ENDL;
 		}
 	}
 }
@@ -2187,7 +2183,7 @@ static void check_for_unrecognized_messages(
 void LLMessageSystem::setMessageBans(
 		const LLSD& trusted, const LLSD& untrusted)
 {
-	llinfos << "LLMessageSystem::setMessageBans:" << llendl;
+	LL_DEBUGS("AppInit") << "LLMessageSystem::setMessageBans:" << LL_ENDL;
 	bool any_set = false;
 
 	for (message_template_name_map_t::iterator iter = mMessageTemplates.begin(),
@@ -2207,17 +2203,17 @@ void LLMessageSystem::setMessageBans(
 
 		if (ban_from_trusted  ||  ban_from_untrusted)
 		{
-			llinfos << "    " << name << " banned from "
+			LL_INFOS("AppInit") << "    " << name << " banned from "
 				<< (ban_from_trusted ? "TRUSTED " : " ")
 				<< (ban_from_untrusted ? "UNTRUSTED " : " ")
-				<< llendl;
+				<< LL_ENDL;
 			any_set = true;
 		}
 	}
 
 	if (!any_set) 
 	{
-		llinfos << "    no messages banned" << llendl;
+		LL_DEBUGS("AppInit") << "    no messages banned" << LL_ENDL;
 	}
 
 	check_for_unrecognized_messages("trusted", trusted, mMessageTemplates);
@@ -2267,7 +2263,7 @@ S32 LLMessageSystem::sendError(
 	}
 	else
 	{
-		llwarns << "Data and message were too large -- data removed."
+		LL_WARNS("Messaging") << "Data and message were too large -- data removed."
 			<< llendl;
 		addBinaryData("Data", NULL, 0);
 	}
@@ -2288,7 +2284,7 @@ void	process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/)
 		for (S32 i = 0; i < ack_count; i++)
 		{
 			msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i);
-//			llinfos << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl;
+//			LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl;
 			cdp->ackReliablePacket(packet_id);
 		}
 		if (!cdp->getUnackedPacketCount())
@@ -2309,12 +2305,12 @@ void process_log_messages(LLMessageSystem* msg, void**)
 	
 	if (log_message)
 	{
-		llinfos << "Starting logging via message" << llendl;
+		LL_INFOS("Messaging") << "Starting logging via message" << llendl;
 		msg->startLogging();
 	}
 	else
 	{
-		llinfos << "Stopping logging via message" << llendl;
+		LL_INFOS("Messaging") << "Stopping logging via message" << llendl;
 		msg->stopLogging();
 	}
 }*/
@@ -2333,7 +2329,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 	LLCircuitData *cdp = msg->mCircuitInfo.findCircuit(msg->getSender());
 	if (!cdp)
 	{
-		llwarns << "Attempt to create trusted circuit without circuit data: "
+		LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: "
 				<< msg->getSender() << llendl;
 		return;
 	}
@@ -2358,7 +2354,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 	if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id))
 	{
 		cdp->setTrusted(TRUE);
-		llinfos << "Trusted digest from " << msg->getSender() << llendl;
+		LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl;
 		return;
 	}
 	else if (cdp->getTrusted())
@@ -2367,13 +2363,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 		// This means that this could just be the result of a stale deny sent from a while back, and
 		// the message system is being slow.  Don't bother sending the deny, as it may continually
 		// ping-pong back and forth on a very hosed circuit.
-		llwarns << "Ignoring bad digest from known trusted circuit: " << their_digest
+		LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest
 			<< " host: " << msg->getSender() << llendl;
 		return;
 	}
 	else
 	{
-		llwarns << "Bad digest from known circuit: " << their_digest
+		LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest
 				<< " host: " << msg->getSender() << llendl;
 		msg->sendDenyTrustedCircuit(msg->getSender());
 		return;
@@ -2410,7 +2406,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
 	// spin.
 	// *TODO: probably should keep a count of number of resends
 	// per circuit, and stop resending after a while.
-	llinfos << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to "
+	LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to "
 			<< msg->getSender() << llendl;
 	msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id);
 }
@@ -2499,7 +2495,7 @@ BOOL start_messaging_system(
 
 	if (!gMessageSystem)
 	{
-		llerrs << "Messaging system initialization failed." << llendl;
+		LL_ERRS("AppInit") << "Messaging system initialization failed." << LL_ENDL;
 		return FALSE;
 	}
 
@@ -2518,12 +2514,12 @@ BOOL start_messaging_system(
 	{
 		if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber)
 		{
-			llinfos << "Message template version does not match prehash version number" << llendl;
-			llinfos << "Run simulator with -prehash command line option to rebuild prehash data" << llendl;
+			LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL;
+			LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl;
 		}
 		else
 		{
-			llinfos << "Message template version matches prehash version number" << llendl;
+			LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl;
 		}
 	}
 
@@ -2569,7 +2565,7 @@ void LLMessageSystem::startLogging()
 	str << "\t<-\tincoming message" <<std::endl;
 	str << "\t->\toutgoing message" << std::endl;
 	str << "     <>        host           size    zero      id name";
-	llinfos << str.str() << llendl;
+	LL_INFOS("Messaging") << str.str() << llendl;
 }
 
 void LLMessageSystem::stopLogging()
@@ -2577,7 +2573,7 @@ void LLMessageSystem::stopLogging()
 	if(mVerboseLog)
 	{
 		mVerboseLog = FALSE;
-		llinfos << "END MESSAGE LOG" << llendl;
+		LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl;
 	}
 }
 
@@ -2683,7 +2679,7 @@ void end_messaging_system()
 
 		std::ostringstream str;
 		gMessageSystem->summarizeLogs(str);
-		llinfos << str.str().c_str() << llendl;
+		LL_INFOS("Messaging") << str.str().c_str() << llendl;
 
 		delete gMessageSystem;
 		gMessageSystem = NULL;
@@ -2735,7 +2731,7 @@ void LLMessageSystem::dumpReceiveCounts()
 
 	if(mNumMessageCounts > 0)
 	{
-		llinfos << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl;
+		LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl;
 		for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
 				 end = mMessageTemplates.end();
 			 iter != end; iter++)
@@ -2743,7 +2739,7 @@ void LLMessageSystem::dumpReceiveCounts()
 			const LLMessageTemplate* mt = iter->second;
 			if (mt->mReceiveCount > 0)
 			{
-				llinfos << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
+				LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
 						<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
 			}
 		}
@@ -2860,7 +2856,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 {
 	if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE)
 	{
-		llwarns << "zeroCodeExpand() called with data_size of " << *data_size
+		LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size
 			<< llendl;
 	}
 
@@ -2900,7 +2896,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 	{
 		if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1]))
 		{
-			llwarns << "attempt to write past reasonable encoded buffer size 1" << llendl;
+			LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl;
 			callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 			outptr = mEncodedRecvBuffer;					
 			break;
@@ -2912,7 +2908,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 				*outptr++ = *inptr++;
   				if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256]))
   				{
-  					llwarns << "attempt to write past reasonable encoded buffer size 2" << llendl;
+  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl;
 					callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 					outptr = mEncodedRecvBuffer;
 					count = -1;
@@ -2931,7 +2927,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 			{
   				if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)]))
 				{
-  					llwarns << "attempt to write past reasonable encoded buffer size 3" << llendl;
+  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl;
 					callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 					outptr = mEncodedRecvBuffer;					
 				}
@@ -2954,7 +2950,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep)
 {
 	if (mMessageTemplates.count(templatep->mName) > 0)
 	{	
-		llerrs << templatep->mName << " already  used as a template name!"
+		LL_ERRS("Messaging") << templatep->mName << " already  used as a template name!"
 			<< llendl;
 	}
 	mMessageTemplates[templatep->mName] = templatep;
@@ -2971,7 +2967,7 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)(
 	}
 	else
 	{
-		llerrs << name << " is not a known message name!" << llendl;
+		LL_ERRS("Messaging") << name << " is not a known message name!" << llendl;
 	}
 }
 
@@ -2983,7 +2979,7 @@ bool LLMessageSystem::callHandler(const char *name,
 	iter = mMessageTemplates.find(name);
 	if(iter == mMessageTemplates.end())
 	{
-		llwarns << "LLMessageSystem::callHandler: unknown message " 
+		LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message " 
 			<< name << llendl;
 		return false;
 	}
@@ -2991,7 +2987,7 @@ bool LLMessageSystem::callHandler(const char *name,
 	const LLMessageTemplate* msg_template = iter->second;
 	if (msg_template->isBanned(trustedSource))
 	{
-		llwarns << "LLMessageSystem::callHandler: banned message " 
+		LL_WARNS("Messaging") << "LLMessageSystem::callHandler: banned message " 
 			<< name 
 			<< " from "
 			<< (trustedSource ? "trusted " : "untrusted ")
@@ -3131,7 +3127,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		llerrs << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
 	}
 
 	U32 now = time(NULL);
@@ -3150,7 +3146,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		llerrs << "Trying to compare complex digests on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl;
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
@@ -3197,7 +3193,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		llerrs << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
 	}
 
 	U32 now = time(NULL);
@@ -3216,7 +3212,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		llerrs << "Trying to compare simple digests on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl;
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
@@ -3250,12 +3246,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
 	char digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
 	if (id1.isNull())
 	{
-		llwarns << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl;
+		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl;
 		return;
 	}
 	if (id2.isNull())
 	{
-		llwarns << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl;
+		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl;
 		return;
 	}
 	generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2);
@@ -3263,7 +3259,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
 	nextBlockFast(_PREHASH_DataBlock);
 	addUUIDFast(_PREHASH_EndPointID, id1);
 	addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES);
-	llinfos << "xmitting digest: " << digest << " Host: " << host << llendl;
+	LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl;
 	sendMessage(host);
 }
 
@@ -3277,10 +3273,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host)
 	LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
 	if (!cdp)
 	{
-		llwarns << "Not sending DenyTrustedCircuit to host without a circuit." << llendl;
+		LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl;
 		return;
 	}
-	llinfos << "Sending DenyTrustedCircuit to " << host << llendl;
+	LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl;
 	newMessageFast(_PREHASH_DenyTrustedCircuit);
 	nextBlockFast(_PREHASH_DataBlock);
 	addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID());
@@ -3301,7 +3297,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		llerrs << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl;
 	}
 	LLTimer timeout;
 
@@ -3353,8 +3349,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
 
 void LLMessageSystem::dumpPacketToLog()
 {
-	llwarns << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
-	llwarns << "Packet Size:" << mTrueReceiveSize << llendl;
+	LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
+	LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl;
 	char line_buffer[256];		/* Flawfinder: ignore */
 	S32 i;
 	S32 cur_line_pos = 0;
@@ -3369,13 +3365,13 @@ void LLMessageSystem::dumpPacketToLog()
 		if (cur_line_pos >= 16)
 		{
 			cur_line_pos = 0;
-			llwarns << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+			LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
 			cur_line++;
 		}
 	}
 	if (cur_line_pos)
 	{
-		llwarns << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+		LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
 	}
 }
 
@@ -3919,7 +3915,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var,
 {
 	if(buffer_size <= 0)
 	{
-		llwarns << "buffer_size <= 0" << llendl;
+		LL_WARNS("Messaging") << "buffer_size <= 0" << llendl;
 	}
 	mMessageReader->getString(block, var, buffer_size, s, blocknum);
 }
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index 50b34148d41..2807076ef6b 100644
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -185,7 +185,7 @@ S32 start_net(S32& socket_out, int& nPort)
 	{
 		S32 err = WSAGetLastError();
 		WSACleanup();
-		llwarns << "Windows Sockets initialization failed, err " << err << llendl;
+		LL_WARNS("AppInit") << "Windows Sockets initialization failed, err " << err << LL_ENDL;
 		return 1;
 	}
 
@@ -195,7 +195,7 @@ S32 start_net(S32& socket_out, int& nPort)
 	{
 		S32 err = WSAGetLastError();
 		WSACleanup();
-		llwarns << "socket() failed, err " << err << llendl;
+		LL_WARNS("AppInit") << "socket() failed, err " << err << LL_ENDL;
 		return 2;
 	}
 
@@ -205,7 +205,7 @@ S32 start_net(S32& socket_out, int& nPort)
 	stLclAddr.sin_port        = htons(nPort);
 
 	S32 attempt_port = nPort;
-	llinfos << "attempting to connect on port " << attempt_port << llendl;
+	LL_DEBUGS("AppInit") << "attempting to connect on port " << attempt_port << LL_ENDL;
 	nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
 
 	if (nRet == SOCKET_ERROR)
@@ -219,7 +219,7 @@ S32 start_net(S32& socket_out, int& nPort)
 				attempt_port++)
 			{
 				stLclAddr.sin_port = htons(attempt_port);
-				llinfos << "trying port " << attempt_port << llendl;
+				LL_DEBUGS("AppInit") << "trying port " << attempt_port << LL_ENDL;
 				nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
 
 				if (!(nRet == SOCKET_ERROR && 
@@ -231,7 +231,7 @@ S32 start_net(S32& socket_out, int& nPort)
 
 			if (nRet == SOCKET_ERROR)
 			{
-				llwarns << "startNet() : Couldn't find available network port." << llendl;
+				LL_WARNS("AppInit") << "startNet() : Couldn't find available network port." << LL_ENDL;
 				// Fail gracefully here in release
 				return 3;
 			}
@@ -239,7 +239,7 @@ S32 start_net(S32& socket_out, int& nPort)
 		else
 		// Some other socket error
 		{
-			llwarns << llformat("bind() port: %d failed, Err: %d\n", nPort, WSAGetLastError()) << llendl;
+			LL_WARNS("AppInit") << llformat("bind() port: %d failed, Err: %d\n", nPort, WSAGetLastError()) << LL_ENDL;
 			// Fail gracefully in release.
 			return 4;
 		}
@@ -250,7 +250,7 @@ S32 start_net(S32& socket_out, int& nPort)
 	getsockname(hSocket, (SOCKADDR*) &socket_address, &socket_address_size);
 	attempt_port = ntohs(socket_address.sin_port);
 
-	llinfos << "connected on port " << attempt_port << llendl;
+	LL_INFOS("AppInit") << "connected on port " << attempt_port << LL_ENDL;
 	nPort = attempt_port;
 	
 	// Set socket to be non-blocking
@@ -266,20 +266,20 @@ S32 start_net(S32& socket_out, int& nPort)
 	nRet = setsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, buff_size);
 	if (nRet)
 	{
-		llinfos << "Can't set receive buffer size!" << llendl;
+		LL_INFOS("AppInit") << "Can't set receive buffer size!" << LL_ENDL;
 	}
 
 	nRet = setsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, buff_size);
 	if (nRet)
 	{
-		llinfos << "Can't set send buffer size!" << llendl;
+		LL_INFOS("AppInit") << "Can't set send buffer size!" << LL_ENDL;
 	}
 
 	getsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, &buff_size);
 	getsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, &buff_size);
 
-	llinfos << "startNet - receive buffer size : " << rec_size << llendl;
-	llinfos << "startNet - send buffer size    : " << snd_size << llendl;
+	LL_DEBUGS("AppInit") << "startNet - receive buffer size : " << rec_size << LL_ENDL;
+	LL_DEBUGS("AppInit") << "startNet - send buffer size    : " << snd_size << LL_ENDL;
 
 	//  Setup a destination address
 	char achMCAddr[MAXADDRSTR] = " ";	/* Flawfinder: ignore */ 
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 11139599994..3a408b5550f 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -241,7 +241,7 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname,
 			font_path = sys_path + *token_iter;
 			if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE))
 			{
-				llwarns << "Couldn't load font " << *token_iter << llendl;
+				LL_INFOS_ONCE("ViewerImages") << "Couldn't load font " << *token_iter << LL_ENDL;
 				delete fontp;
 				fontp = NULL;
 			}
@@ -268,7 +268,7 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi
 		font_path = sys_path + fontname;
 		if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE))
 		{
-			llwarns << "Couldn't load font " << fontname << llendl;
+			LL_WARNS("ViewerImages") << "Couldn't load font " << fontname << LL_ENDL;
 			return false;
 		}
 	}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b5958455463..7bb79d49738 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -832,8 +832,14 @@ void LLFloater::setMinimized(BOOL minimize)
 
 		for (S32 i = 0; i < 4; i++)
 		{
-			if (mResizeBar[i]) mResizeBar[i]->setEnabled(FALSE);
-			if (mResizeHandle[i]) mResizeHandle[i]->setEnabled(FALSE);
+			if (mResizeBar[i] != NULL)
+			{
+				mResizeBar[i]->setEnabled(FALSE);
+			}
+			if (mResizeHandle[i] != NULL)
+			{
+				mResizeHandle[i]->setEnabled(FALSE);
+			}
 		}
 
 		mMinimized = TRUE;
@@ -875,8 +881,14 @@ void LLFloater::setMinimized(BOOL minimize)
 
 		for (S32 i = 0; i < 4; i++)
 		{
-			if (mResizeBar[i]) mResizeBar[i]->setEnabled(isResizable());
-			if (mResizeHandle[i]) mResizeHandle[i]->setEnabled(isResizable());
+			if (mResizeBar[i] != NULL)
+			{
+				mResizeBar[i]->setEnabled(isResizable());
+			}
+			if (mResizeHandle[i] != NULL)
+			{
+				mResizeHandle[i]->setEnabled(isResizable());
+			}
 		}
 
 		mMinimized = FALSE;
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index ae35b656d6d..3604d3f86f1 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -492,21 +492,21 @@ bool LLDir::setCacheDir(const std::string &path)
 
 void LLDir::dumpCurrentDirectories()
 {
-	llinfos << "Current Directories:" << llendl;
-
-	llinfos << "  CurPath:               " << getCurPath() << llendl;
-	llinfos << "  AppName:               " << getAppName() << llendl;
-	llinfos << "  ExecutableFilename:    " << getExecutableFilename() << llendl;
-	llinfos << "  ExecutableDir:         " << getExecutableDir() << llendl;
-	llinfos << "  ExecutablePathAndName: " << getExecutablePathAndName() << llendl;
-	llinfos << "  WorkingDir:            " << getWorkingDir() << llendl;
-	llinfos << "  AppRODataDir:          " << getAppRODataDir() << llendl;
-	llinfos << "  OSUserDir:             " << getOSUserDir() << llendl;
-	llinfos << "  OSUserAppDir:          " << getOSUserAppDir() << llendl;
-	llinfos << "  LindenUserDir:         " << getLindenUserDir() << llendl;
-	llinfos << "  TempDir:               " << getTempDir() << llendl;
-	llinfos << "  CAFile:				 " << getCAFile() << llendl;
-	llinfos << "  SkinDir:               " << getSkinDir() << llendl;
+	LL_DEBUGS2("AppInit","Directories") << "Current Directories:" << LL_ENDL;
+
+	LL_DEBUGS2("AppInit","Directories") << "  CurPath:               " << getCurPath() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  AppName:               " << getAppName() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  ExecutableFilename:    " << getExecutableFilename() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  ExecutableDir:         " << getExecutableDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  WorkingDir:            " << getWorkingDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  AppRODataDir:          " << getAppRODataDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  OSUserDir:             " << getOSUserDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  OSUserAppDir:          " << getOSUserAppDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  LindenUserDir:         " << getLindenUserDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  TempDir:               " << getTempDir() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  CAFile:				 " << getCAFile() << LL_ENDL;
+	LL_DEBUGS2("AppInit","Directories") << "  SkinDir:               " << getSkinDir() << LL_ENDL;
 }
 
 
diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp
index 66d333ccaf8..cb04dee8347 100644
--- a/indra/llvfs/llvfs.cpp
+++ b/indra/llvfs/llvfs.cpp
@@ -248,7 +248,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 	mDataFilename = new char[strlen(data_filename) + 1];	/* Flawfinder: ignore */
 	if (mIndexFilename == NULL || mDataFilename  == NULL)
 	{
-		llerrs << "Memory Allocation Failure" << llendl;
+		LL_ERRS("VFS") << "Memory Allocation Failure" << LL_ENDL;
 		return;
 	}
 	strcpy(mIndexFilename, index_filename);	/* Flawfinder: ignore */
@@ -261,7 +261,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
     	
 		if (mReadOnly)
 		{
-			llwarns << "Can't find " << mDataFilename << " to open read-only VFS" << llendl;
+			LL_WARNS("VFS") << "Can't find " << mDataFilename << " to open read-only VFS" << LL_ENDL;
 			mValid = VFSVALID_BAD_CANNOT_OPEN_READONLY;
 			return;
 		}
@@ -274,18 +274,18 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 		}
 		else
 		{
-			llwarns << "Can't open VFS data file " << mDataFilename << " attempting to use alternate" << llendl;
+			LL_WARNS("VFS") << "Can't open VFS data file " << mDataFilename << " attempting to use alternate" << LL_ENDL;
     
 			char *temp_index = new char[strlen(mIndexFilename) + 10];	/* Flawfinder: ignore */
 			if (!temp_index)
 			{
-				llerrs << "Out of the memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
+				LL_ERRS("VFS") << "Out of the memory in LLVFS::LLVFS()" << LL_ENDL;
 				return;
 			}
 			char *temp_data = new char[strlen(mDataFilename) + 10];	/* Flawfinder: ignore */
 			if (!temp_data)
 			{
-				llerrs << "Out of the memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
+				LL_ERRS("VFS") << "Out of the memory in LLVFS::LLVFS()" << LL_ENDL;
 				return;
 			}
 
@@ -310,7 +310,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
     
 			if (! mDataFP)
 			{
-				llwarns << "Couldn't open vfs data file after trying many alternates" << llendl;
+				LL_WARNS("VFS") << "Couldn't open vfs data file after trying many alternates" << LL_ENDL;
 				mValid = VFSVALID_BAD_CANNOT_CREATE;
 				delete[] temp_index;
 				delete[] temp_data;
@@ -338,7 +338,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 		char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1];	/* Flawfinder: ignore */
 		if (!marker )
 		{
-			llerrs << "Out of memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
+			LL_ERRS("VFS") << "Out of memory in LLVFS::LLVFS()" << LL_ENDL;
 			return;
 		}
 		sprintf(marker, "%s.open", mDataFilename);	/* Flawfinder: ignore */
@@ -348,7 +348,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 			unlockAndClose(mDataFP);
 			mDataFP = NULL;
 
-			llwarns << "VFS: File left open on last run, removing old VFS file " << mDataFilename << llendl;
+			LL_WARNS("VFS") << "VFS: File left open on last run, removing old VFS file " << mDataFilename << LL_ENDL;
 			LLFile::remove(mIndexFilename);
 			LLFile::remove(mDataFilename);
 			LLFile::remove(marker);
@@ -356,7 +356,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 			mDataFP = openAndLock(mDataFilename, "w+b", FALSE);
 			if (!mDataFP)
 			{
-				llwarns << "Can't open VFS data file in crash recovery" << llendl;
+				LL_WARNS("VFS") << "Can't open VFS data file in crash recovery" << LL_ENDL;
 				mValid = VFSVALID_BAD_CANNOT_CREATE;
 				return;
 			}
@@ -414,9 +414,9 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 			if (block->mLength && block->mSize > 0)
 			{
 				// this is corrupt, not empty
-				llwarns << "VFS corruption: " << block->mFileID << " (" << block->mFileType << ") at index " << block->mIndexLocation << " DS: " << data_size << llendl;
-				llwarns << "Length: " << block->mLength << "\tLocation: " << block->mLocation << "\tSize: " << block->mSize << llendl;
-				llwarns << "File has bad data - VFS removed" << llendl;
+				LL_WARNS("VFS") << "VFS corruption: " << block->mFileID << " (" << block->mFileType << ") at index " << block->mIndexLocation << " DS: " << data_size << LL_ENDL;
+				LL_WARNS("VFS") << "Length: " << block->mLength << "\tLocation: " << block->mLocation << "\tSize: " << block->mSize << LL_ENDL;
+				LL_WARNS("VFS") << "File has bad data - VFS removed" << LL_ENDL;
 
 				delete[] buffer;
 				delete block;
@@ -481,13 +481,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 				if (cur_file_block->mLocation == last_file_block->mLocation
 					&& cur_file_block->mLength == last_file_block->mLength)
 				{
-					llwarns << "VFS: removing duplicate entry"
+					LL_WARNS("VFS") << "VFS: removing duplicate entry"
 						<< " at " << cur_file_block->mLocation 
 						<< " length " << cur_file_block->mLength 
 						<< " size " << cur_file_block->mSize
 						<< " ID " << cur_file_block->mFileID 
 						<< " type " << cur_file_block->mFileType 
-						<< llendl;
+						<< LL_ENDL;
 
 					// Duplicate entries.  Nuke them both for safety.
 					mFileBlocks.erase(*cur_file_block);	// remove ID/type entry
@@ -528,12 +528,12 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 					mDataFP = NULL;
 					LLFile::remove( mDataFilename );
 
-					llwarns << "VFS: overlapping entries"
+					LL_WARNS("VFS") << "VFS: overlapping entries"
 						<< " at " << cur_file_block->mLocation 
 						<< " length " << cur_file_block->mLength 
 						<< " ID " << cur_file_block->mFileID 
 						<< " type " << cur_file_block->mFileType 
-						<< llendl;
+						<< LL_ENDL;
 					mValid = VFSVALID_BAD_CORRUPT;
 					return;
 				}
@@ -563,7 +563,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 	{
 		if (mReadOnly)
 		{
-			llwarns << "Can't find " << mIndexFilename << " to open read-only VFS" << llendl;
+			LL_WARNS("VFS") << "Can't find " << mIndexFilename << " to open read-only VFS" << LL_ENDL;
 			mValid = VFSVALID_BAD_CANNOT_OPEN_READONLY;
 			return;
 		}
@@ -572,7 +572,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 		mIndexFP = openAndLock(mIndexFilename, "w+b", FALSE);
 		if (!mIndexFP)
 		{
-			llwarns << "Couldn't open an index file for the VFS, probably a sharing violation!" << llendl;
+			LL_WARNS("VFS") << "Couldn't open an index file for the VFS, probably a sharing violation!" << LL_ENDL;
 
 			unlockAndClose( mDataFP );
 			mDataFP = NULL;
@@ -593,7 +593,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 		char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1];
 		if (!marker)
 		{
-			llerrs << "Out of memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
+			LL_ERRS("VFS") << "Out of memory in LLVFS::LLVFS()" << LL_ENDL;
 			return;
 		}
 		sprintf(marker, "%s.open", mDataFilename);	/* Flawfinder: ignore */
@@ -607,7 +607,8 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
 		marker = NULL;
 	}
 
-	llinfos << "VFS: Using index file " << mIndexFilename << " and data file " << mDataFilename << llendl;
+	LL_WARNS("VFS") << "Using index file " << mIndexFilename << LL_ENDL;
+	LL_WARNS("VFS") << "Using data file " << mDataFilename << LL_ENDL;
 
 	mValid = VFSVALID_OK;
 }
@@ -616,7 +617,7 @@ LLVFS::~LLVFS()
 {
 	if (mDataMutex->isLocked())
 	{
-		llerrs << "LLVFS destroyed with mutex locked" << llendl;
+		LL_ERRS("VFS") << "LLVFS destroyed with mutex locked" << LL_ENDL;
 	}
 	
 	unlockAndClose(mIndexFP);
@@ -642,7 +643,7 @@ LLVFS::~LLVFS()
 		char* marker_file = new char[strlen(mDataFilename) + strlen(".open") + 1];
 		if (marker_file == NULL)
 		{
-			llerrs << "Memory Allocation Failure" << llendl;
+			LL_ERRS("VFS") << "Memory Allocation Failure" << LL_ENDL;
 			return;
 		}
 		sprintf(marker_file, "%s.open", mDataFilename);	/* Flawfinder: ignore */
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index be8416cc23a..e3cbf6d9d2a 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -304,7 +304,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 	IDxDiagContainer *driver_containerp = NULL;
 
     // CoCreate a IDxDiagProvider*
-	llinfos << "CoCreateInstance IID_IDxDiagProvider" << llendl;
+	LL_DEBUGS("AppInit") << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
     hr = CoCreateInstance(CLSID_DxDiagProvider,
                           NULL,
                           CLSCTX_INPROC_SERVER,
@@ -313,7 +313,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 
 	if (FAILED(hr))
 	{
-		llwarns << "No DXDiag provider found!  DirectX 9 not installed!" << llendl;
+		LL_WARNS("AppInit") << "No DXDiag provider found!  DirectX 9 not installed!" << LL_ENDL;
 		gWriteDebug("No DXDiag provider found!  DirectX 9 not installed!\n");
 		goto LCleanup;
 	}
@@ -331,14 +331,14 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
         dx_diag_init_params.bAllowWHQLChecks        = TRUE;
         dx_diag_init_params.pReserved               = NULL;
 
-		llinfos << "dx_diag_providerp->Initialize" << llendl;
+		LL_DEBUGS("AppInit") << "dx_diag_providerp->Initialize" << LL_ENDL;
         hr = dx_diag_providerp->Initialize(&dx_diag_init_params);
         if(FAILED(hr))
 		{
             goto LCleanup;
 		}
 
-		llinfos << "dx_diag_providerp->GetRootContainer" << llendl;
+		LL_DEBUGS("AppInit") << "dx_diag_providerp->GetRootContainer" << LL_ENDL;
         hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp );
         if(FAILED(hr) || !dx_diag_rootp)
 		{
@@ -348,7 +348,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		HRESULT hr;
 
 		// Get display driver information
-		llinfos << "dx_diag_rootp->GetChildContainer" << llendl;
+		LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer" << LL_ENDL;
 		hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp);
 		if(FAILED(hr) || !devices_containerp)
 		{
@@ -356,7 +356,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		}
 
 		// Get device 0
-		llinfos << "devices_containerp->GetChildContainer" << llendl;
+		LL_DEBUGS("AppInit") << "devices_containerp->GetChildContainer" << LL_ENDL;
 		hr = devices_containerp->GetChildContainer(L"0", &device_containerp);
 		if(FAILED(hr) || !device_containerp)
 		{
@@ -373,10 +373,9 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		  // Dump the string as an int into the structure
 		  char *stopstring;
 		  mVRAM = strtol(ram_str.c_str(), &stopstring, 10); 
-		  llinfos << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << llendl;
+		  LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL;
 		}
 
-		
 		if (vram_only)
 		{
 			ok = TRUE;
@@ -393,7 +392,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		// This call may take some time while dxdiag gathers the info.
 		DWORD num_devices = 0;
 	    WCHAR wszContainer[256];
-		llinfos << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << llendl;
+		LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << LL_ENDL;
 		hr = dx_diag_rootp->GetChildContainer(L"DxDiag_SystemDevices", &system_device_containerp);
 		if (FAILED(hr))
 		{
@@ -406,7 +405,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 			goto LCleanup;
 		}
 
-		llinfos << "DX9 iterating over devices" << llendl;
+		LL_DEBUGS("AppInit") << "DX9 iterating over devices" << LL_ENDL;
 		S32 device_num = 0;
 		for (device_num = 0; device_num < (S32)num_devices; device_num++)
 		{
@@ -523,7 +522,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 LCleanup:
 	if (!ok)
 	{
-		llwarns << "DX9 probe failed" << llendl;
+		LL_WARNS("AppInit") << "DX9 probe failed" << LL_ENDL;
 		gWriteDebug("DX9 probe failed\n");
 	}
 
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index ba92e804025..4940e06f392 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -359,7 +359,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 
 	if (mFullscreen && (mOldDisplayMode == NULL))
 	{
-		llinfos << "createContext: setting up fullscreen " << width << "x" << height << llendl;
+		LL_INFOS("Window") << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL;
 
 		// NOTE: The refresh rate will be REPORTED AS 0 for many DVI and notebook displays.  Plan accordingly.
 		double refresh = getDictDouble (CGDisplayCurrentMode (mDisplay),  kCGDisplayRefreshRate);
@@ -380,18 +380,18 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 				U32 closestWidth = 0;
 				int i;
 
-				llinfos << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << llendl;
+				LL_DEBUGS("Window") << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL;
 
 				for(i=0; i < resolutionCount; i++)
 				{
 					F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight;
 
-					llinfos << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << llendl;
+					LL_DEBUGS("Window") << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL;
 
 					if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) &&
 						(fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio)))
 					{
-						llinfos << " (new closest mode) " << llendl;
+						LL_DEBUGS("Window") << " (new closest mode) " << LL_ENDL;
 
 						// This is the closest mode we've seen yet.
 						closestWidth = resolutionList[i].mWidth;
@@ -437,7 +437,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 
 			if (refDisplayMode)
 			{
-				llinfos << "createContext: switching display resolution" << llendl;
+				LL_DEBUGS("Window") << "createContext: switching display resolution" << LL_ENDL;
 				mOldDisplayMode = CGDisplayCurrentMode (mDisplay);
 				CGDisplaySwitchToMode (mDisplay, refDisplayMode);
 				//				CFRelease(refDisplayMode);
@@ -452,11 +452,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 			mFullscreenBits    = CGDisplayBitsPerPixel(mDisplay);
 			mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay),  kCGDisplayRefreshRate));
 
-			llinfos << "Running at " << mFullscreenWidth
+			LL_INFOS("Window") << "Running at " << mFullscreenWidth
 				<< "x"   << mFullscreenHeight
 				<< "x"   << mFullscreenBits
 				<< " @ " << mFullscreenRefresh
-				<< llendl;
+				<< LL_ENDL;
 		}
 		else
 		{
@@ -480,7 +480,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		//int				displayHeight = CGDisplayPixelsHigh(mDisplay);
 		//const int		menuBarPlusTitleBar = 44;   // Ugly magic number.
 
-		llinfos << "createContext: creating window" << llendl;
+		LL_DEBUGS("Window") << "createContext: creating window" << LL_ENDL;
 
 		window_rect.left = (long) x;
 		window_rect.right = (long) x + width;
@@ -534,7 +534,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		err = NewTSMDocument(1, types, &mTSMDocument, 0);
 		if (err != noErr)
 		{
-			llwarns << "createContext: couldn't create a TSMDocument (" << err << ")" << llendl;
+			LL_WARNS("Window") << "createContext: couldn't create a TSMDocument (" << err << ")" << LL_ENDL;
 		}
 		if (mTSMDocument)
 		{
@@ -575,7 +575,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 						AGL_NONE
 				};
 
-				llinfos << "createContext: creating fullscreen pixelformat" << llendl;
+				LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL;
 
 				GDHandle gdhDisplay = NULL;
 				err = DMGetGDeviceByDisplayID ((DisplayIDType)mDisplay, &gdhDisplay, false);
@@ -602,7 +602,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 						AGL_NONE
 				};
 
-				llinfos << "createContext: creating windowed pixelformat" << llendl;
+				LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;
 
 				mPixelFormat = aglChoosePixelFormat(NULL, 0, windowedAttrib);
 
@@ -622,7 +622,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 
 		if(mPixelFormat)
 		{
-			llinfos << "createContext: creating GL context" << llendl;
+			LL_DEBUGS("Window") << "createContext: creating GL context" << LL_ENDL;
 			mContext = aglCreateContext(mPixelFormat, NULL);
 		}
 
@@ -670,7 +670,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 	{
 		// We successfully captured the display.  Use a fullscreen drawable
 
-		llinfos << "createContext: attaching fullscreen drawable" << llendl;
+		LL_DEBUGS("Window") << "createContext: attaching fullscreen drawable" << LL_ENDL;
 
 #if CAPTURE_ALL_DISPLAYS
 		// Capture all displays (may want to do this for final build)
@@ -688,7 +688,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 	}
 	else if(!mFullscreen && (mWindow != NULL))
 	{
-		llinfos << "createContext: attaching windowed drawable" << llendl;
+		LL_DEBUGS("Window") << "createContext: attaching windowed drawable" << LL_ENDL;
 
 		// We created a window.  Use it as the drawable.
 		if(!aglSetDrawable(mContext, GetWindowPort (mWindow)))
@@ -705,7 +705,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 
 	if(mContext != NULL)
 	{
-		llinfos << "createContext: setting current context" << llendl;
+		LL_DEBUGS("Window") << "createContext: setting current context" << LL_ENDL;
 
 		if (!aglSetCurrentContext(mContext))
 		{
@@ -759,11 +759,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 		return FALSE;
 	}
 
-	llinfos << "GL buffer: Color Bits " << S32(colorBits)
+	LL_INFOS("GLInit") << "GL buffer: Color Bits " << S32(colorBits)
 		<< " Alpha Bits " << S32(alphaBits)
 		<< " Depth Bits " << S32(depthBits)
 		<< " Stencil Bits" << S32(stencilBits)
-		<< llendl;
+		<< LL_ENDL;
 
 	if (colorBits < 32)
 	{
@@ -798,12 +798,12 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 	GLint frames_per_swap = 0;
 	if (disable_vsync)
 	{
-		llinfos << "Disabling vertical sync" << llendl;
+		LL_DEBUGS("GLInit") << "Disabling vertical sync" << LL_ENDL;
 		frames_per_swap = 0;
 	}
 	else
 	{
-		llinfos << "Keeping vertical sync" << llendl;
+		LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL;
 		frames_per_swap = 1;
 	}
 	aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);  
@@ -818,11 +818,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 
 		if (cgl_err != kCGLNoError )
 		{
-			llinfos << "Multi-threaded OpenGL not available." << llendl;
+			LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
 		}    
 		else
 		{
-			llinfos << "Multi-threaded OpenGL enabled." << llendl;
+			LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
 		}
 	}
 
@@ -869,11 +869,11 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, B
 			mFullscreenBits    = CGDisplayBitsPerPixel(mDisplay);
 			mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay),  kCGDisplayRefreshRate));
 
-			llinfos << "Switched resolution to " << mFullscreenWidth
+			LL_INFOS("Window") << "Switched resolution to " << mFullscreenWidth
 				<< "x"   << mFullscreenHeight
 				<< "x"   << mFullscreenBits
 				<< " @ " << mFullscreenRefresh
-				<< llendl;
+				<< LL_ENDL;
 
 			// Update the GL context to the new screen size
 			if (!aglUpdateContext(mContext))
@@ -943,7 +943,7 @@ void LLWindowMacOSX::destroyContext()
 	// Unhook the GL context from any drawable it may have
 	if(mContext != NULL)
 	{
-		llinfos << "destroyContext: unhooking drawable " << llendl;
+		LL_DEBUGS("Window") << "destroyContext: unhooking drawable " << LL_ENDL;
 
 		aglSetCurrentContext (NULL);
 		aglSetDrawable(mContext, NULL);
@@ -952,7 +952,7 @@ void LLWindowMacOSX::destroyContext()
 	// Make sure the display resolution gets restored
 	if(mOldDisplayMode != NULL)
 	{
-		llinfos << "destroyContext: restoring display resolution " << llendl;
+		LL_DEBUGS("Window") << "destroyContext: restoring display resolution " << LL_ENDL;
 
 		CGDisplaySwitchToMode (mDisplay, mOldDisplayMode);
 
@@ -978,7 +978,7 @@ void LLWindowMacOSX::destroyContext()
 	// Clean up the pixel format
 	if(mPixelFormat != NULL)
 	{
-		llinfos << "destroyContext: destroying pixel format " << llendl;
+		LL_DEBUGS("Window") << "destroyContext: destroying pixel format " << LL_ENDL;
 		aglDestroyPixelFormat(mPixelFormat);
 		mPixelFormat = NULL;
 	}
@@ -986,14 +986,14 @@ void LLWindowMacOSX::destroyContext()
 	// Remove any Carbon Event handlers we installed
 	if(mGlobalHandlerRef != NULL)
 	{
-		llinfos << "destroyContext: removing global event handler" << llendl;
+		LL_DEBUGS("Window") << "destroyContext: removing global event handler" << LL_ENDL;
 		RemoveEventHandler(mGlobalHandlerRef);
 		mGlobalHandlerRef = NULL;
 	}
 
 	if(mWindowHandlerRef != NULL)
 	{
-		llinfos << "destroyContext: removing window event handler" << llendl;
+		LL_DEBUGS("Window") << "destroyContext: removing window event handler" << LL_ENDL;
 		RemoveEventHandler(mWindowHandlerRef);
 		mWindowHandlerRef = NULL;
 	}
@@ -1001,7 +1001,7 @@ void LLWindowMacOSX::destroyContext()
 	// Cleanup any TSM document we created.
 	if(mTSMDocument != NULL)
 	{
-		llinfos << "destroyContext: deleting TSM document" << llendl;
+		LL_DEBUGS("Window") << "destroyContext: deleting TSM document" << LL_ENDL;
 		DeactivateTSMDocument(mTSMDocument);
 		DeleteTSMDocument(mTSMDocument);
 		mTSMDocument = NULL;
@@ -1010,7 +1010,7 @@ void LLWindowMacOSX::destroyContext()
 	// Close the window
 	if(mWindow != NULL)
 	{
-		llinfos << "destroyContext: disposing window" << llendl;
+		LL_DEBUGS("Window") << "destroyContext: disposing window" << LL_ENDL;
 		DisposeWindow(mWindow);
 		mWindow = NULL;
 	}
@@ -1018,7 +1018,7 @@ void LLWindowMacOSX::destroyContext()
 	// Clean up the GL context
 	if(mContext != NULL)
 	{
-		llinfos << "destroyContext: destroying GL context" << llendl;
+		LL_DEBUGS("Window") << "destroyContext: destroying GL context" << LL_ENDL;
 		aglDestroyContext(mContext);
 		mContext = NULL;
 	}
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 06b4fbde59f..841cac941a1 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -84,7 +84,7 @@ LLW32MsgCallback gAsyncMsgCallback = NULL;
 
 void show_window_creation_error(const char* title)
 {
-	llwarns << title << llendl;
+	LL_WARNS("Window") << title << LL_ENDL;
 }
 
 //static
@@ -534,7 +534,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
 
 		if (closest_refresh == 0)
 		{
-			llwarns << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << llendl;
+			LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
 			success = FALSE;
 		}
 
@@ -557,11 +557,11 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
 			mFullscreenBits    = dev_mode.dmBitsPerPel;
 			mFullscreenRefresh = dev_mode.dmDisplayFrequency;
 
-			llinfos << "Running at " << dev_mode.dmPelsWidth
+			LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
 				<< "x"   << dev_mode.dmPelsHeight
 				<< "x"   << dev_mode.dmBitsPerPel
 				<< " @ " << dev_mode.dmDisplayFrequency
-				<< llendl;
+				<< LL_ENDL;
 		}
 		else
 		{
@@ -576,7 +576,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
 			OSMessageBox(error, "Error", OSMB_OK);
 		}
 	}
-	
+
 	// TODO: add this after resolving _WIN32_WINNT issue
 	//	if (!fullscreen)
 	//	{
@@ -588,7 +588,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
 	//		TrackMouseEvent( &track_mouse_event ); 
 	//	}
 
-	
+
 	//-----------------------------------------------------------------------
 	// Create GL drawing context
 	//-----------------------------------------------------------------------
@@ -657,7 +657,7 @@ void LLWindowWin32::restore()
 // Usually called from LLWindowManager::destroyWindow()
 void LLWindowWin32::close()
 {
-	llinfos << "Closing LLWindowWin32" << llendl;
+	LL_DEBUGS("Window") << "Closing LLWindowWin32" << LL_ENDL;
 	// Is window is already closed?
 	if (!mWindowHandle)
 	{
@@ -675,20 +675,20 @@ void LLWindowWin32::close()
 	}
 
 	// Clean up remaining GL state
-	llinfos << "Shutting down GL" << llendl;
+	LL_DEBUGS("Window") << "Shutting down GL" << LL_ENDL;
 	gGLManager.shutdownGL();
 
-	llinfos << "Releasing Context" << llendl;
+	LL_DEBUGS("Window") << "Releasing Context" << LL_ENDL;
 	if (mhRC)
 	{
 		if (!wglMakeCurrent(NULL, NULL))
 		{
-			llwarns << "Release of DC and RC failed" << llendl;
+			LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
 		}
 
 		if (!wglDeleteContext(mhRC))
 		{
-			llwarns << "Release of rendering context failed" << llendl;
+			LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
 		}
 
 		mhRC = NULL;
@@ -699,11 +699,11 @@ void LLWindowWin32::close()
 
 	if (mhDC && !ReleaseDC(mWindowHandle, mhDC))
 	{
-		llwarns << "Release of ghDC failed" << llendl;
+		LL_WARNS("Window") << "Release of ghDC failed" << LL_ENDL;
 		mhDC = NULL;
 	}
 
-	llinfos << "Destroying Window" << llendl;
+	LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
 	
 	// Don't process events in our mainWindowProc any longer.
 	SetWindowLong(mWindowHandle, GWL_USERDATA, NULL);
@@ -866,12 +866,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 	{
 		if (!wglMakeCurrent(NULL, NULL))
 		{
-			llwarns << "Release of DC and RC failed" << llendl;
+			LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
 		}
 
 		if (!wglDeleteContext(mhRC))
 		{
-			llwarns << "Release of rendering context failed" << llendl;
+			LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
 		}
 
 		mhRC = NULL;
@@ -905,7 +905,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 
 		if (closest_refresh == 0)
 		{
-			llwarns << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << llendl;
+			LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
 			return FALSE;
 		}
 
@@ -927,11 +927,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			mFullscreenBits    = dev_mode.dmBitsPerPel;
 			mFullscreenRefresh = dev_mode.dmDisplayFrequency;
 
-			llinfos << "Running at " << dev_mode.dmPelsWidth
+			LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
 				<< "x"   << dev_mode.dmPelsHeight
 				<< "x"   << dev_mode.dmBitsPerPel
 				<< " @ " << dev_mode.dmDisplayFrequency
-				<< llendl;
+				<< LL_ENDL;
 
 			window_rect.left = (long) 0;
 			window_rect.right = (long) width;			// Windows GDI rects don't include rightmost pixel
@@ -952,8 +952,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			mFullscreenBits    = -1;
 			mFullscreenRefresh = -1;
 
-			llinfos << "Unable to run fullscreen at " << width << "x" << height << llendl;
-			llinfos << "Running in window." << llendl;
+			LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -1146,7 +1145,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		{
 			if (end_attrib > 0)
 			{
-				llinfos << "No valid pixel format for " << mFSAASamples << "x anti-aliasing." << llendl;
+				LL_INFOS("Window") << "No valid pixel format for " << mFSAASamples << "x anti-aliasing." << LL_ENDL;
 				attrib_list[end_attrib] = 0;
 
 				BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
@@ -1160,7 +1159,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 
 			if (!num_formats)
 			{
-				llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl;
+				LL_INFOS("Window") << "No 32 bit z-buffer, trying 24 bits instead" << LL_ENDL;
 				// Try 24-bit format
 				attrib_list[1] = 24;
 				BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
@@ -1173,7 +1172,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 
 				if (!num_formats)
 				{
-					llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl;
+					LL_WARNS("Window") << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << LL_ENDL;
 					attrib_list[1] = 16;
 					BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
 					if (!result || !num_formats)
@@ -1185,7 +1184,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 				}
 			}
 
-			llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl;
+			LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
 		}
 
 		pixel_format = pixel_formats[0];
@@ -1241,26 +1240,26 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			{
 			case WGL_SWAP_EXCHANGE_ARB:
 				mSwapMethod = SWAP_METHOD_EXCHANGE;
-				llinfos << "Swap Method: Exchange" << llendl;
+				LL_DEBUGS("Window") << "Swap Method: Exchange" << LL_ENDL;
 				break;
 			case WGL_SWAP_COPY_ARB:
 				mSwapMethod = SWAP_METHOD_COPY;
-				llinfos << "Swap Method: Copy" << llendl;
+				LL_DEBUGS("Window") << "Swap Method: Copy" << LL_ENDL;
 				break;
 			case WGL_SWAP_UNDEFINED_ARB:
 				mSwapMethod = SWAP_METHOD_UNDEFINED;
-				llinfos << "Swap Method: Undefined" << llendl;
+				LL_DEBUGS("Window") << "Swap Method: Undefined" << LL_ENDL;
 				break;
 			default:
 				mSwapMethod = SWAP_METHOD_UNDEFINED;
-				llinfos << "Swap Method: Unknown" << llendl;
+				LL_DEBUGS("Window") << "Swap Method: Unknown" << LL_ENDL;
 				break;
 			}
 		}		
 	}
 	else
 	{
-		llwarns << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << llendl;
+		LL_WARNS("Window") << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << LL_ENDL;
 	}
 
 	// Verify what pixel format we actually received.
@@ -1272,10 +1271,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
-	llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits) 
+	LL_INFOS("Window") << "GL buffer: Color Bits " << S32(pfd.cColorBits) 
 		<< " Alpha Bits " << S32(pfd.cAlphaBits)
 		<< " Depth Bits " << S32(pfd.cDepthBits) 
-		<< llendl;
+		<< LL_ENDL;
 
 	// make sure we have 32 bits per pixel
 	if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32)
@@ -1338,12 +1337,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 	// Disable vertical sync for swap
 	if (disable_vsync && wglSwapIntervalEXT)
 	{
-		llinfos << "Disabling vertical sync" << llendl;
+		LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
 		wglSwapIntervalEXT(0);
 	}
 	else
 	{
-		llinfos << "Keeping vertical sync" << llendl;
+		LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
 	}
 
 	SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
@@ -1701,11 +1700,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 
 				if (gDebugWindowProc)
 				{
-					llinfos << "WINDOWPROC ActivateApp "
+					LL_INFOS("Window") << "WINDOWPROC ActivateApp "
 						<< " activating " << S32(activating)
 						<< " minimized " << S32(minimized)
 						<< " fullscreen " << S32(window_imp->mFullscreen)
-						<< llendl;
+						<< LL_ENDL;
 				}
 
 				if (window_imp->mFullscreen)
@@ -1746,10 +1745,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// properly when we run fullscreen.
 				if (gDebugWindowProc)
 				{
-					llinfos << "WINDOWPROC Activate "
+					LL_INFOS("Window") << "WINDOWPROC Activate "
 						<< " activating " << S32(activating) 
 						<< " minimized " << S32(minimized)
-						<< llendl;
+						<< LL_ENDL;
 				}
 
 				// Don't handle this.
@@ -1805,9 +1804,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			{
 				if (gDebugWindowProc)
 				{
-					llinfos << "Debug WindowProc WM_KEYDOWN "
+					LL_INFOS("Window") << "Debug WindowProc WM_KEYDOWN "
 						<< " key " << S32(w_param) 
-						<< llendl;
+						<< LL_ENDL;
 				}
 				if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
 				{
@@ -1824,9 +1823,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 
 			if (gDebugWindowProc)
 			{
-				llinfos << "Debug WindowProc WM_KEYUP "
+				LL_INFOS("Window") << "Debug WindowProc WM_KEYUP "
 					<< " key " << S32(w_param) 
-					<< llendl;
+					<< LL_ENDL;
 			}
 			if (gKeyboard->handleKeyUp(w_param, mask) && eat_keystroke)
 			{
@@ -1909,13 +1908,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			// it is worth trying.  The good old WM_CHAR works just fine even for supplementary
 			// characters.  We just need to take care of surrogate pairs sent as two WM_CHAR's
 			// by ourselves.  It is not that tough.  -- Alissa Sabre @ SL
-			//
-			// llinfos << "WM_CHAR: " << w_param << llendl;
 			if (gDebugWindowProc)
 			{
-				llinfos << "Debug WindowProc WM_CHAR "
+				LL_INFOS("Window") << "Debug WindowProc WM_CHAR "
 					<< " key " << S32(w_param) 
-					<< llendl;
+					<< LL_ENDL;
 			}
 			// Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE,
 			// we *did* processed the event, so I believe we should not pass it to DefWindowProc...
@@ -1985,7 +1982,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
 				//if (gDebugClicks)
 				//{
-				//	llinfos << "WndProc left button up" << llendl;
+				//	LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;
 				//}
 				// Because we move the cursor position in the app, we need to query
 				// to find out where the cursor at the time the event is handled.
@@ -2181,12 +2178,12 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 					BOOL restored  = ( w_param == SIZE_RESTORED );
 					BOOL minimized = ( w_param == SIZE_MINIMIZED );
 
-					llinfos << "WINDOWPROC Size "
+					LL_INFOS("Window") << "WINDOWPROC Size "
 						<< width << "x" << height
 						<< " max " << S32(maximized)
 						<< " min " << S32(minimized)
 						<< " rest " << S32(restored)
-						<< llendl;
+						<< LL_ENDL;
 				}
 
 				// There's an odd behavior with WM_SIZE that I would call a bug. If 
@@ -2232,7 +2229,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 		case WM_SETFOCUS:
 			if (gDebugWindowProc)
 			{
-				llinfos << "WINDOWPROC SetFocus" << llendl;
+				LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL;
 			}
 			window_imp->mCallbacks->handleFocus(window_imp);
 			return 0;
@@ -2240,7 +2237,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 		case WM_KILLFOCUS:
 			if (gDebugWindowProc)
 			{
-				llinfos << "WINDOWPROC KillFocus" << llendl;
+				LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL;
 			}
 			window_imp->mCallbacks->handleFocusLost(window_imp);
 			return 0;
@@ -2596,7 +2593,7 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
 {
 	mCurrentGamma = gamma;
 
-	llinfos << "Setting gamma to " << gamma << llendl;
+	LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL;
 
 	for ( int i = 0; i < 256; ++i )
 	{
@@ -2737,8 +2734,8 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re
 
 	if (!success)
 	{
-		llwarns << "setDisplayResolution failed, "
-			<< width << "x" << height << "x" << bits << " @ " << refresh << llendl;
+		LL_WARNS("Window") << "setDisplayResolution failed, "
+			<< width << "x" << height << "x" << bits << " @ " << refresh << LL_ENDL;
 	}
 
 	return success;
@@ -2760,7 +2757,7 @@ BOOL LLWindowWin32::setFullscreenResolution()
 // protected
 BOOL LLWindowWin32::resetDisplayResolution()
 {
-	llinfos << "resetDisplayResolution START" << llendl;
+	LL_DEBUGS("Window") << "resetDisplayResolution START" << LL_ENDL;
 
 	LONG cds_result = ChangeDisplaySettings(NULL, 0);
 
@@ -2768,10 +2765,10 @@ BOOL LLWindowWin32::resetDisplayResolution()
 
 	if (!success)
 	{
-		llwarns << "resetDisplayResolution failed" << llendl;
+		LL_WARNS("Window") << "resetDisplayResolution failed" << LL_ENDL;
 	}
 
-	llinfos << "resetDisplayResolution END" << llendl;
+	LL_DEBUGS("Window") << "resetDisplayResolution END" << LL_ENDL;
 
 	return success;
 }
@@ -2908,11 +2905,11 @@ void spawn_web_browser(const char* escaped_url )
 
 	if (!found)
 	{
-		llwarns << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << llendl;
+		LL_WARNS("Window") << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << LL_ENDL;
 		return;
 	}
 
-	llinfos << "Opening URL " << escaped_url << llendl;
+	LL_INFOS("Window") << "Opening URL " << escaped_url << LL_ENDL;
 
 	// replaced ShellExecute code with ShellExecuteEx since ShellExecute doesn't work
 	// reliablly on Vista.
@@ -2952,7 +2949,7 @@ void spawn_web_browser(const char* escaped_url )
 
 	if (browser_open_wstring.length() < 2)
 	{
-		llwarns << "Invalid browser executable in registry " << browser_open_wstring << llendl;
+		LL_WARNS("Window") << "Invalid browser executable in registry " << browser_open_wstring << LL_ENDL;
 		return;
 	}
 
@@ -2972,8 +2969,8 @@ void spawn_web_browser(const char* escaped_url )
 		browser_executable = browser_open_wstring.substr(0, space_pos);
 	}
 
-	llinfos << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << llendl;
-	llinfos << "Browser executable: " << wstring_to_utf8str(browser_executable) << llendl;
+	LL_DEBUGS("Window") << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << LL_ENDL;
+	LL_INFOS("Window") << "Browser executable: " << wstring_to_utf8str(browser_executable) << LL_ENDL;
 
 	// Convert URL to wide string for Windows API
 	// Assume URL is UTF8, as can come from scripts
@@ -2995,11 +2992,11 @@ void spawn_web_browser(const char* escaped_url )
 									SW_SHOWNORMAL);
 	if (retval > 32)
 	{
-		llinfos << "load_url success with " << retval << llendl;
+		LL_DEBUGS("Window") << "load_url success with " << retval << LL_ENDL;
 	}
 	else
 	{
-		llinfos << "load_url failure with " << retval << llendl;
+		LL_INFOS("Window") << "load_url failure with " << retval << LL_ENDL;
 	}
 	*/
 }
@@ -3541,7 +3538,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
 
 				if (!mPreeditor->getPreeditLocation(position, &caret_coord, &preedit_bounds, &text_control))
 				{
-					llwarns << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << llendl;
+					LL_WARNS("Window") << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << LL_ENDL;
 					return FALSE;
 				}
 				fillCharPosition(caret_coord, preedit_bounds, text_control, char_position);
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 2c4fb3bcccd..0429e30db62 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -50,9 +50,9 @@
 #include "llsdserialize.h"
 
 #if LL_RELEASE_FOR_DOWNLOAD
-#define CONTROL_ERRS llwarns
+#define CONTROL_ERRS LL_WARNS("ControlErrors")
 #else
-#define CONTROL_ERRS llerrs
+#define CONTROL_ERRS LL_ERRS("ControlErrors")
 #endif
 
 //this defines the current version of the settings file
diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml
index 3e6fa21cc6e..ec12794bc59 100644
--- a/indra/newview/app_settings/cmd_line.xml
+++ b/indra/newview/app_settings/cmd_line.xml
@@ -1,335 +1,335 @@
-<?xml version="1.0"?>
-<llsd>
-  <map>
-    <key>help</key>
-    <map>
-      <key>desc</key>
-      <string>display this help message</string>
-
-      <key>short</key>
-      <string>h</string>
-    </map>
-
-    <key>port</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>UserConnectionPort</string>
-    </map>
-
-    <key>drop</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>PacketDropPercentage</string>
-    </map>
-
-    <key>inbw</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>InBandwidth</string>
-    </map>
-
-    <key>outbw</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>OutBandwidth</string>
-    </map>
-
-    <key>grid</key>
-    <map>
-      <key>desc</key>
-      <string>Specify the name of the grid, local, or an IP address to connect to.</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>GridChoice</string>
-    </map>
-
-    <key>loginuri</key>
-    <map>
-      <key>desc</key>
-      <string>login server and CGI script to use</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>compose</key>
-      <boolean>true</boolean>
-      <key>map-to</key>
-      <string>LoginURI</string>
-    </map>
-
-    <key>helperuri</key>
-    <map>
-      <key>desc</key>
-      <string>helper web CGI prefix to use</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>HelperURI</string>
-    </map>
-
-    <key>debugviews</key>
-    <map>
-      <key>map-to</key>
-      <string>DebugViews</string>
-    </map>
-
-    <key>skin</key>
-    <map>
-      <key>desc</key>
-      <string>ui/branding skin folder to use</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>SkinFolder</string>
-    </map>
-
-    <key>autologin</key>
-    <map>
-      <key>desc</key>
-      <string>log in as last saved user</string>
-      <key>map-to</key>
-      <string>AutoLogin</string>
-    </map>
-
-    <key>quitafter</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>QuitAfterSeconds</string>
-    </map>
-
-    <key>rotate</key>
-    <map>
-      <key>map-to</key>
-      <string>RotateRight</string>
-    </map>
-
-    <key>noaudio</key>
-    <map>
-      <key>map-to</key>
-      <string>NoAudio</string>
-    </map>
-
-    <key>nosound</key>
-    <map>
-      <key>map-to</key>
-      <string>NoAudio</string>
-    </map>
-
-    <key>noprobe</key>
-    <map>
-      <key>map-to</key>
-      <string>NoHardwareProbe</string>
-    </map>
-
-    <key>noquicktime</key>
-    <map>
-      <key>map-to</key>
-      <string>NoQuickTime</string>
-    </map>
-
-    <key>nopreload</key>
-    <map>
-      <key>map-to</key>
-      <string>NoPreload</string>
-    </map>
-
-    <key>purge</key>
-    <map>
-      <key>desc</key>
-      <string>Delete files in the cache.</string>
-      <key>map-to</key>
-      <string>PurgeCacheOnNextStartup</string>
-    </map>
-
-    <key>noinvlib</key>
-    <map>
-      <key>desc</key>
-      <string>Do not request the inventory library.</string>
-      <key>map-to</key>
-      <string>NoInventoryLibrary</string>
-    </map>
-
-    <key>logfile</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>UserLogFile</string>
-    </map>
-
-    <key>setdefault</key>
-    <map>
-      <key>desc</key>
-      <string> specify the value of a particular
-               configuration variable which can be
-               overridden by settings.xml
-      </string>
-      <key>count</key>
-      <integer>2</integer>
-      <!-- Special case. Mapped to settings procedurally. -->
-    </map>
-
-    <key>set</key>
-    <map>
-      <key>desc</key>
-      <string> specify the value of a particular
-               configuration variable that
-               overrides all other settings
-      </string>
-      <key>count</key>
-      <integer>2</integer>
-      <!-- Special case. Mapped to settings procedurally. -->
-    </map>
-
-    <key>settings</key>
-    <map>
-      <key>desc</key>
-      <string>Specify the filename of a configuration file.</string>
-      <key>count</key>
-      <integer>1</integer>
-      <!-- Special case. Mapped to settings procedurally. -->
-    </map>
-
-    <key>login</key>
-    <map>
-      <key>desc</key>
-      <string>3 tokens: first, last and password</string>
-      <key>count</key>
-      <integer>3</integer>
-      <key>map-to</key>
-      <string>UserLoginInfo</string>
-    </map>
-
-    <key>god</key>
-    <map>
-      <key>desc</key>
-      <string>Log in a god if you have god access.</string>
-      <key>map-to</key>
-      <string>ConnectAsGod</string>
-    </map>
-
-    <key>console</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>ShowConsoleWindow</string>
-    </map>
-
-    <key>safe</key>
-    <map>
-      <key>desc</key>
-      <string>Reset preferences, run in safe mode.</string>
-      <key>map-to</key>
-      <string>SafeMode</string>
-    </map>
-
-    <key>multiple</key>		  
-    <map>
-      <key>desc</key>
-      <string>Allow multple viewers.</string>
-      <key>map-to</key>
-      <string>AllowMultipleViewers</string>
-    </map>
-
-    <key>novoice</key>
-    <map>
-      <key>desc</key>
-      <string>Disable voice.</string>
-      <key>map-to</key>
-      <string>CmdLineDisableVoice</string>
-    </map>
-
-    <key>url</key>
-    <map>
-      <key>desc</key>
-      <string>Startup location</string>            
-      <key>count</key>
-      <integer>1</integer>
-      <key>last_option</key>
-      <boolean>true</boolean>
-      <!-- Special case. Not mapped to a setting. -->
-    </map>
-
-    <key>slurl</key>
-    <map>
-      <key>desc</key>
-      <string>Startup SLurl</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>positional</key>
-      <boolean>true</boolean>
-      <key>last_option</key>
-      <boolean>true</boolean>
-      <!-- Special case. Not mapped to a setting. -->
-    </map>
-
-    <key>ignorepixeldepth</key>
-    <map>
-      <key>desc</key>
-      <string>Ignore pixel depth settings.</string>
-      <key>map-to</key>
-      <string>IgnorePixelDepth</string>
-    </map>
-
-    <key>cooperative</key>
-    <map>
-      <key>desc</key>
-      <string>Yield some idle time to local host.</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>YieldTime</string>
-    </map>
-
-    <key>no-verify-ssl-cert</key>
-    <map>
-      <key>map-to</key>
-      <string>NoVerifySSLCert</string>
-    </map>
-
-    <key>channel</key>
-    <map>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>VersionChannelName</string>
-    </map>
-
-    <key>loginpage</key>
-    <map>
-      <key>desc</key>
-      <string>Login authentication page to use.</string>
-      <key>count</key>
-      <integer>1</integer>
-      <key>map-to</key>
-      <string>LoginPage</string>
-    </map>
-
-    <key>qa</key>
-    <map>
-      <key>desc</key>
-      <string>Activated debugging menu in Advanced Settings.</string>
-      <key>map-to</key>
-      <string>QAMode</string>
-    </map>
-
-    <key>crashonstartup</key>
-    <map>
-      <key>desc</key>
-      <string>Crashes on startup. For QA use.</string>
-      <key>map-to</key>
-      <string>CrashOnStartup</string>
-    </map>
-
-  </map>
-</llsd>
+<?xml version="1.0"?>
+<llsd>
+  <map>
+    <key>help</key>
+    <map>
+      <key>desc</key>
+      <string>display this help message</string>
+
+      <key>short</key>
+      <string>h</string>
+    </map>
+
+    <key>port</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>UserConnectionPort</string>
+    </map>
+
+    <key>drop</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>PacketDropPercentage</string>
+    </map>
+
+    <key>inbw</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>InBandwidth</string>
+    </map>
+
+    <key>outbw</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>OutBandwidth</string>
+    </map>
+
+    <key>grid</key>
+    <map>
+      <key>desc</key>
+      <string>Specify the name of the grid, local, or an IP address to connect to.</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>GridChoice</string>
+    </map>
+
+    <key>loginuri</key>
+    <map>
+      <key>desc</key>
+      <string>login server and CGI script to use</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>compose</key>
+      <boolean>true</boolean>
+      <key>map-to</key>
+      <string>LoginURI</string>
+    </map>
+
+    <key>helperuri</key>
+    <map>
+      <key>desc</key>
+      <string>helper web CGI prefix to use</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>HelperURI</string>
+    </map>
+
+    <key>debugviews</key>
+    <map>
+      <key>map-to</key>
+      <string>DebugViews</string>
+    </map>
+
+    <key>skin</key>
+    <map>
+      <key>desc</key>
+      <string>ui/branding skin folder to use</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>SkinFolder</string>
+    </map>
+
+    <key>autologin</key>
+    <map>
+      <key>desc</key>
+      <string>log in as last saved user</string>
+      <key>map-to</key>
+      <string>AutoLogin</string>
+    </map>
+
+    <key>quitafter</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>QuitAfterSeconds</string>
+    </map>
+
+    <key>rotate</key>
+    <map>
+      <key>map-to</key>
+      <string>RotateRight</string>
+    </map>
+
+    <key>noaudio</key>
+    <map>
+      <key>map-to</key>
+      <string>NoAudio</string>
+    </map>
+
+    <key>nosound</key>
+    <map>
+      <key>map-to</key>
+      <string>NoAudio</string>
+    </map>
+
+    <key>noprobe</key>
+    <map>
+      <key>map-to</key>
+      <string>NoHardwareProbe</string>
+    </map>
+
+    <key>noquicktime</key>
+    <map>
+      <key>map-to</key>
+      <string>NoQuickTime</string>
+    </map>
+
+    <key>nopreload</key>
+    <map>
+      <key>map-to</key>
+      <string>NoPreload</string>
+    </map>
+
+    <key>purge</key>
+    <map>
+      <key>desc</key>
+      <string>Delete files in the cache.</string>
+      <key>map-to</key>
+      <string>PurgeCacheOnNextStartup</string>
+    </map>
+
+    <key>noinvlib</key>
+    <map>
+      <key>desc</key>
+      <string>Do not request the inventory library.</string>
+      <key>map-to</key>
+      <string>NoInventoryLibrary</string>
+    </map>
+
+    <key>logfile</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>UserLogFile</string>
+    </map>
+
+    <key>setdefault</key>
+    <map>
+      <key>desc</key>
+      <string> specify the value of a particular
+               configuration variable which can be
+               overridden by settings.xml
+      </string>
+      <key>count</key>
+      <integer>2</integer>
+      <!-- Special case. Mapped to settings procedurally. -->
+    </map>
+
+    <key>set</key>
+    <map>
+      <key>desc</key>
+      <string> specify the value of a particular
+               configuration variable that
+               overrides all other settings
+      </string>
+      <key>count</key>
+      <integer>2</integer>
+      <!-- Special case. Mapped to settings procedurally. -->
+    </map>
+
+    <key>settings</key>
+    <map>
+      <key>desc</key>
+      <string>Specify the filename of a configuration file.</string>
+      <key>count</key>
+      <integer>1</integer>
+      <!-- Special case. Mapped to settings procedurally. -->
+    </map>
+
+    <key>login</key>
+    <map>
+      <key>desc</key>
+      <string>3 tokens: first, last and password</string>
+      <key>count</key>
+      <integer>3</integer>
+      <key>map-to</key>
+      <string>UserLoginInfo</string>
+    </map>
+
+    <key>god</key>
+    <map>
+      <key>desc</key>
+      <string>Log in a god if you have god access.</string>
+      <key>map-to</key>
+      <string>ConnectAsGod</string>
+    </map>
+
+    <key>console</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>ShowConsoleWindow</string>
+    </map>
+
+    <key>safe</key>
+    <map>
+      <key>desc</key>
+      <string>Reset preferences, run in safe mode.</string>
+      <key>map-to</key>
+      <string>SafeMode</string>
+    </map>
+
+    <key>multiple</key>		  
+    <map>
+      <key>desc</key>
+      <string>Allow multple viewers.</string>
+      <key>map-to</key>
+      <string>AllowMultipleViewers</string>
+    </map>
+
+    <key>novoice</key>
+    <map>
+      <key>desc</key>
+      <string>Disable voice.</string>
+      <key>map-to</key>
+      <string>CmdLineDisableVoice</string>
+    </map>
+
+    <key>url</key>
+    <map>
+      <key>desc</key>
+      <string>Startup location</string>            
+      <key>count</key>
+      <integer>1</integer>
+      <key>last_option</key>
+      <boolean>true</boolean>
+      <!-- Special case. Not mapped to a setting. -->
+    </map>
+
+    <key>slurl</key>
+    <map>
+      <key>desc</key>
+      <string>Startup SLurl</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>positional</key>
+      <boolean>true</boolean>
+      <key>last_option</key>
+      <boolean>true</boolean>
+      <!-- Special case. Not mapped to a setting. -->
+    </map>
+
+    <key>ignorepixeldepth</key>
+    <map>
+      <key>desc</key>
+      <string>Ignore pixel depth settings.</string>
+      <key>map-to</key>
+      <string>IgnorePixelDepth</string>
+    </map>
+
+    <key>cooperative</key>
+    <map>
+      <key>desc</key>
+      <string>Yield some idle time to local host.</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>YieldTime</string>
+    </map>
+
+    <key>no-verify-ssl-cert</key>
+    <map>
+      <key>map-to</key>
+      <string>NoVerifySSLCert</string>
+    </map>
+
+    <key>channel</key>
+    <map>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>VersionChannelName</string>
+    </map>
+
+    <key>loginpage</key>
+    <map>
+      <key>desc</key>
+      <string>Login authentication page to use.</string>
+      <key>count</key>
+      <integer>1</integer>
+      <key>map-to</key>
+      <string>LoginPage</string>
+    </map>
+
+    <key>qa</key>
+    <map>
+      <key>desc</key>
+      <string>Activated debugging menu in Advanced Settings.</string>
+      <key>map-to</key>
+      <string>QAMode</string>
+    </map>
+
+    <key>crashonstartup</key>
+    <map>
+      <key>desc</key>
+      <string>Crashes on startup. For QA use.</string>
+      <key>map-to</key>
+      <string>CrashOnStartup</string>
+    </map>
+
+  </map>
+</llsd>
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
new file mode 100644
index 00000000000..d7bb64ce8a7
--- /dev/null
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -0,0 +1,47 @@
+<llsd>
+	<map>
+		<!-- default-level can be ALL, DEBUG, INFO, WARN, ERROR, or NONE -->
+		<key>default-level</key>    <string>INFO</string>
+		<key>print-location</key>   <boolean>false</boolean>
+		<key>settings</key>
+			<array>
+				<!-- sample entry for changing settings on specific items -->
+				<map>
+					<key>level</key><string>INFO</string>
+					<key>functions</key>
+						<array>
+						</array>
+					<key>classes</key>
+						<array>
+						</array>
+					<key>files</key>
+						<array>
+						</array>
+					<key>tags</key>
+						<array>
+							<string>AppInit</string>
+							<string>SystemInfo</string>
+							<string>TextureCache</string>
+							<string>AppCache</string>
+							<string>Window</string>
+							<string>RenderInit</string>
+						</array>
+				</map>
+				<map>
+					<key>level</key><string>DEBUG</string>
+					<key>functions</key>
+						<array>
+						</array>
+					<key>classes</key>
+						<array>
+						</array>
+					<key>files</key>
+						<array>
+						</array>
+					<key>tags</key>
+						<array>
+						</array>
+				</map>
+			</array>
+	</map>
+</llsd>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2d391c44163..d895d7e991d 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4072,6 +4072,17 @@
         <key>Value</key>
             <integer>0</integer>
         </map>
+    <key>MainloopTimeoutDefault</key>
+        <map>
+        <key>Comment</key>
+            <string>Timeout duration for mainloop lock detection, in seconds.</string>
+        <key>Persist</key>
+            <integer>1</integer>
+        <key>Type</key>
+            <string>F32</string>
+        <key>Value</key>
+            <real>10.0</real>
+        </map>
     <key>MapOverlayIndex</key>
         <map>
         <key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index b8adfe5477d..b1b59a71f85 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -122,6 +122,7 @@
 #include "llhudeffecttrail.h"
 #include "llvectorperfoptions.h"
 #include "llurlsimstring.h"
+#include "llwatchdog.h"
 
 // Included so that constants/settings might be initialized
 // in save_settings_to_globals()
@@ -593,10 +594,16 @@ LLAppViewer::LLAppViewer() :
 	}
 
 	sInstance = this;
+
+	// Initialize the mainloop timeout. 
+	mMainloopTimeout = new LLWatchdogTimeout();
 }
 
 LLAppViewer::~LLAppViewer()
 {
+	// Initialize the mainloop timeout. 
+	delete mMainloopTimeout;
+
 	// If we got to this destructor somehow, the app didn't hang.
 	removeMarkerFile();
 }
@@ -650,7 +657,7 @@ bool LLAppViewer::init()
 	//
 	// Various introspection concerning the libs we're using.
 	//
-	llinfos << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << llendl;
+	LL_DEBUGS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL;
 
 	// Get the single value from the crash settings file, if it exists
 	std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
@@ -693,15 +700,15 @@ bool LLAppViewer::init()
 	
 	// Load art UUID information, don't require these strings to be declared in code.
 	LLString colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml");
-	llinfos << "Loading base colors from " << colors_base_filename << llendl;
+	LL_DEBUGS("InitInfo") << "Loading base colors from " << colors_base_filename << LL_ENDL;
 	gColors.loadFromFileLegacy(colors_base_filename.c_str(), FALSE, TYPE_COL4U);
 
 	// Load overrides from user colors file
 	LLString user_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.xml");
-	llinfos << "Loading user colors from " << user_colors_filename << llendl;
+	LL_DEBUGS("InitInfo") << "Loading user colors from " << user_colors_filename << LL_ENDL;
 	if (gColors.loadFromFileLegacy(user_colors_filename.c_str(), FALSE, TYPE_COL4U) == 0)
 	{
-		llinfos << "Cannot load user colors from " << user_colors_filename << llendl;
+		LL_DEBUGS("InitInfo") << "Cannot load user colors from " << user_colors_filename << LL_ENDL;
 	}
 
 	// Widget construction depends on LLUI being initialized
@@ -792,7 +799,7 @@ bool LLAppViewer::init()
 	#endif
 
 	gGLManager.getGLInfo(gDebugInfo);
-	llinfos << gGLManager.getGLInfoString() << llendl;
+	gGLManager.printGLInfoString();
 
 	//load key settings
 	bind_keyboard_functions();
@@ -800,7 +807,7 @@ bool LLAppViewer::init()
 	// Load Default bindings
 	if (!gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keys.ini").c_str()))
 	{
-		llerrs << "Unable to open keys.ini" << llendl;
+		LL_ERRS("InitInfo") << "Unable to open keys.ini" << LL_ENDL;
 	}
 	// Load Custom bindings (override defaults)
 	gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini").c_str());
@@ -881,6 +888,10 @@ bool LLAppViewer::init()
 
 bool LLAppViewer::mainLoop()
 {
+	mMainloopTimeout = new LLWatchdogTimeout();
+	// *FIX:Mani - Make this a setting, once new settings exist in this branch.
+	mMainloopTimeout->setTimeout(5);
+	
 	//-------------------------------------------
 	// Run main loop until time to quit
 	//-------------------------------------------
@@ -912,7 +923,7 @@ bool LLAppViewer::mainLoop()
 			{
 				LLFastTimer t2(LLFastTimer::FTM_MESSAGES);
 			#if LL_WINDOWS
-				if (!LLWinDebug::setupExceptionHandler())
+				if (!LLWinDebug::checkExceptionHandler())
 				{
 					llwarns << " Someone took over my exception handler (post messagehandling)!" << llendl;
 				}
@@ -1061,6 +1072,8 @@ bool LLAppViewer::mainLoop()
 				}
 				//LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering.
 				//LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering.
+
+				mMainloopTimeout->ping();
 			}
 						
 		}
@@ -1085,6 +1098,8 @@ bool LLAppViewer::mainLoop()
 	
 	delete gServicePump;
 
+	mMainloopTimeout->stop();
+
 	llinfos << "Exiting main_loop" << llendflush;
 
 	return true;
@@ -1348,7 +1363,9 @@ bool LLAppViewer::cleanup()
 	gStaticVFS = NULL;
 	delete gVFS;
 	gVFS = NULL;
-	
+
+	LLWatchdog::getInstance()->cleanup();
+
 	end_messaging_system();
 
 	// *NOTE:Mani - The following call is not thread safe. 
@@ -1382,6 +1399,9 @@ bool LLAppViewer::initThreads()
 #else
 	static const bool enable_threads = true;
 #endif
+
+	LLWatchdog::getInstance()->init();
+
 	LLVFSThread::initClass(enable_threads && true);
 	LLLFSThread::initClass(enable_threads && true);
 
@@ -1436,7 +1456,7 @@ bool LLAppViewer::initLogging()
 }
 
 void LLAppViewer::loadSettingsFromDirectory(ELLPath path_index)
-{
+{	
 	for(LLSD::map_iterator itr = mSettingsFileList.beginMap(); itr != mSettingsFileList.endMap(); ++itr)
 	{
 		LLString settings_name = (*itr).first;
@@ -1489,7 +1509,7 @@ std::string LLAppViewer::getSettingsFileName(const std::string& file)
 }
 
 bool LLAppViewer::initConfiguration()
-{
+{	
 	//Set up internal pointers	
 	gSettings[sGlobalSettingsName] = &gSavedSettings;
 	gSettings[sPerAccountSettingsName] = &gSavedPerAccountSettings;
@@ -2023,7 +2043,7 @@ bool LLAppViewer::initConfiguration()
 
 bool LLAppViewer::initWindow()
 {
-	llinfos << "Initializing window..." << llendl;
+	LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
 
 	// store setting in a global for easy access and modification
 	gNoRender = gSavedSettings.getBOOL("DisableRendering");
@@ -2193,22 +2213,22 @@ void LLAppViewer::writeSystemInfo()
 	gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
 
 	// Dump some debugging info
-	llinfos << gSecondLife
+	LL_INFOS("SystemInfo") << gSecondLife
 			<< " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH
-			<< llendl;
+			<< LL_ENDL;
 
 	// Dump the local time and time zone
 	time_t now;
 	time(&now);
 	char tbuffer[256];		/* Flawfinder: ignore */
 	strftime(tbuffer, 256, "%Y-%m-%dT%H:%M:%S %Z", localtime(&now));
-	llinfos << "Local time: " << tbuffer << llendl;
+	LL_INFOS("SystemInfo") << "Local time: " << tbuffer << LL_ENDL;
 
 	// query some system information
-	llinfos << "CPU info:\n" << gSysCPU << llendl;
-	llinfos << "Memory info:\n" << gSysMemory << llendl;
-	llinfos << "OS: " << getOSInfo().getOSStringSimple() << llendl;
-	llinfos << "OS info: " << getOSInfo() << llendl;
+	LL_INFOS("SystemInfo") << "CPU info:\n" << gSysCPU << LL_ENDL;
+	LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL;
+	LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL;
+	LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL;
 }
 
 void LLAppViewer::handleSyncViewerCrash()
@@ -2220,6 +2240,8 @@ void LLAppViewer::handleSyncViewerCrash()
 
 void LLAppViewer::handleViewerCrash()
 {
+	llinfos << "Handle viewer crash entry." << llendl;
+	
 	LLAppViewer* pApp = LLAppViewer::instance();
 	if (pApp->beingDebugged())
 	{
@@ -2286,11 +2308,11 @@ void LLAppViewer::handleViewerCrash()
 		apr_file_t* crash_file =  ll_apr_file_open(crash_file_name, LL_APR_W);
 		if (crash_file)
 		{
-			llinfos << "Created crash marker file " << crash_file_name << llendl;
+			LL_INFOS("MarkerFile") << "Created crash marker file " << crash_file_name << LL_ENDL;
 		}
 		else
 		{
-			llwarns << "Cannot create error marker file " << crash_file_name << llendl;
+			LL_WARNS("MarkerFile") << "Cannot create error marker file " << crash_file_name << LL_ENDL;
 		}
 		apr_file_close(crash_file);
 	}
@@ -2302,6 +2324,7 @@ void LLAppViewer::handleViewerCrash()
 		llofstream file(filename.c_str(), llofstream::binary);
 		if(file.good())
 		{
+			llinfos << "Handle viewer crash generating stats log." << llendl;
 			gMessageSystem->summarizeLogs(file);
 			file.close();
 		}
@@ -2317,6 +2340,7 @@ void LLAppViewer::handleViewerCrash()
 
 	// Close the debug file
 	pApp->closeDebug();
+
 	LLError::logToFile("");
 
 	// Remove the marker file, since otherwise we'll spawn a process that'll keep it locked
@@ -2347,7 +2371,7 @@ bool LLAppViewer::anotherInstanceRunning()
 	// If the file is currently locked, that means another process is already running.
 
 	std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, MARKER_FILE_NAME);
-	llinfos << "Checking marker file for lock..." << llendl;
+	LL_DEBUGS("MarkerFile") << "Checking marker file for lock..." << LL_ENDL;
 
 	//Freeze case checks
 	apr_file_t* fMarker = ll_apr_file_open(marker_file, LL_APR_RB);		
@@ -2359,19 +2383,19 @@ bool LLAppViewer::anotherInstanceRunning()
 		if (fMarker == NULL)
 		{
 			// Another instance is running. Skip the rest of these operations.
-			llinfos << "Marker file is locked." << llendl;
+			LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL;
 			return TRUE;
 		}
 		if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) //flock(fileno(fMarker), LOCK_EX | LOCK_NB) == -1)
 		{
 			apr_file_close(fMarker);
-			llinfos << "Marker file is locked." << llendl;
+			LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL;
 			return TRUE;
 		}
 		// No other instances; we'll lock this file now & delete on quit.
 		apr_file_close(fMarker);
 	}
-	llinfos << "Marker file isn't locked." << llendl;
+	LL_DEBUGS("MarkerFile") << "Marker file isn't locked." << LL_ENDL;
 	return FALSE;
 }
 
@@ -2382,7 +2406,7 @@ void LLAppViewer::initMarkerFile()
 	//There are marker files for two different types of crashes
 	
 	mMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,MARKER_FILE_NAME);
-	llinfos << "Checking marker file for lock..." << llendl;
+	LL_DEBUGS("MarkerFile") << "Checking marker file for lock..." << LL_ENDL;
 
 	//We've got 4 things to test for here
 	// - Other Process Running (SecondLife.exec_marker present, locked)
@@ -2400,7 +2424,7 @@ void LLAppViewer::initMarkerFile()
 	if(fMarker != NULL)
 	{
 		apr_file_close(fMarker);
-		llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl;
+		LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << LL_ENDL;
 		gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
 	}	
 	fMarker = ll_apr_file_open(llerror_marker_file, LL_APR_RB);
@@ -2415,7 +2439,7 @@ void LLAppViewer::initMarkerFile()
 	if(fMarker != NULL)
 	{
 		apr_file_close(fMarker);
-		llinfos << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << llendl;
+		LL_INFOS("MarkerFile") << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << LL_ENDL;
 		if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
 		else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
 	}
@@ -2435,34 +2459,33 @@ void LLAppViewer::initMarkerFile()
 	{
 		apr_file_close(fMarker);
 		gLastExecEvent = LAST_EXEC_FROZE;
-		llinfos << "Exec marker found: program froze on previous execution" << llendl;
+		LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL;
 	}
 
 	// Create the marker file for this execution & lock it
 	mMarkerFile =  ll_apr_file_open(mMarkerFileName, LL_APR_W);
 	if (mMarkerFile)
 	{
-		llinfos << "Marker file created." << llendl;
+		LL_DEBUGS("MarkerFile") << "Marker file created." << LL_ENDL;
 	}
 	else
 	{
-		llinfos << "Failed to create marker file." << llendl;
+		LL_INFOS("MarkerFile") << "Failed to create marker file." << LL_ENDL;
 		return;
 	}
 	if (apr_file_lock(mMarkerFile, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) 
 	{
 		apr_file_close(mMarkerFile);
-		llinfos << "Marker file cannot be locked." << llendl;
+		LL_INFOS("MarkerFile") << "Marker file cannot be locked." << LL_ENDL;
 		return;
 	}
 
-	llinfos << "Marker file locked." << llendl;
-	llinfos << "Exiting initMarkerFile()." << llendl;
+	LL_DEBUGS("MarkerFile") << "Marker file locked." << LL_ENDL;
 }
 
 void LLAppViewer::removeMarkerFile(bool leave_logout_marker)
 {
-	llinfos << "removeMarkerFile()" << llendl;
+	LL_DEBUGS("MarkerFile") << "removeMarkerFile()" << LL_ENDL;
 	if (mMarkerFile != NULL)
 	{
 		ll_apr_file_remove( mMarkerFileName );
@@ -2587,7 +2610,7 @@ bool LLAppViewer::initCache()
 	
 	if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")))
 	{
-		llwarns << "Unable to set cache location" << llendl;
+		LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL;
 		gSavedSettings.setString("CacheLocation", "");
 	}
 	
@@ -2624,7 +2647,7 @@ bool LLAppViewer::initCache()
 	{
 		gSavedSettings.setU32("VFSOldSize", vfs_size_u32/MB);
 	}
-	llinfos << "VFS CACHE SIZE: " << vfs_size/(1024*1024) << " MB" << llendl;
+	LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size/(1024*1024) << " MB" << LL_ENDL;
 	
 	// This has to happen BEFORE starting the vfs
 	//time_t	ltime;
@@ -2688,8 +2711,7 @@ bool LLAppViewer::initCache()
 			{
 				sscanf(found_file.c_str() + start_pos, "%d", &old_salt);
 			}
-			llinfos << "Default vfs data file not present, found " << old_vfs_data_file << llendl;
-			llinfos << "Old salt: " << old_salt << llendl;
+			LL_DEBUGS("AppCache") << "Default vfs data file not present, found: " << old_vfs_data_file << " Old salt: " << old_salt << llendl;
 		}
 	}
 
@@ -2701,8 +2723,8 @@ bool LLAppViewer::initCache()
 	if (stat_result)
 	{
 		// We've got a bad/missing index file, nukem!
-		llwarns << "Bad or missing vfx index file " << old_vfs_index_file << llendl;
-		llwarns << "Removing old vfs data file " << old_vfs_data_file << llendl;
+		LL_WARNS("AppCache") << "Bad or missing vfx index file " << old_vfs_index_file << LL_ENDL;
+		LL_WARNS("AppCache") << "Removing old vfs data file " << old_vfs_data_file << LL_ENDL;
 		LLFile::remove(old_vfs_data_file);
 		LLFile::remove(old_vfs_index_file);
 		
@@ -2739,7 +2761,7 @@ bool LLAppViewer::initCache()
 
 	if (resize_vfs)
 	{
-		llinfos << "Removing old vfs and re-sizing" << llendl;
+		LL_DEBUGS("AppCache") << "Removing old vfs and re-sizing" << LL_ENDL;
 		
 		LLFile::remove(old_vfs_data_file);
 		LLFile::remove(old_vfs_index_file);
@@ -2747,8 +2769,8 @@ bool LLAppViewer::initCache()
 	else if (old_salt != new_salt)
 	{
 		// move the vfs files to a new name before opening
-		llinfos << "Renaming " << old_vfs_data_file << " to " << new_vfs_data_file << llendl;
-		llinfos << "Renaming " << old_vfs_index_file << " to " << new_vfs_index_file << llendl;
+		LL_DEBUGS("AppCache") << "Renaming " << old_vfs_data_file << " to " << new_vfs_data_file << LL_ENDL;
+		LL_DEBUGS("AppCache") << "Renaming " << old_vfs_index_file << " to " << new_vfs_index_file << LL_ENDL;
 		LLFile::rename(old_vfs_data_file, new_vfs_data_file);
 		LLFile::rename(old_vfs_index_file, new_vfs_index_file);
 	}
@@ -2762,7 +2784,7 @@ bool LLAppViewer::initCache()
 	{
 		// Try again with fresh files 
 		// (The constructor deletes corrupt files when it finds them.)
-		llwarns << "VFS corrupt, deleted.  Making new VFS." << llendl;
+		LL_WARNS("AppCache") << "VFS corrupt, deleted.  Making new VFS." << LL_ENDL;
 		delete gVFS;
 		gVFS = new LLVFS(new_vfs_index_file, new_vfs_data_file, false, vfs_size_u32, false);
 	}
@@ -2783,9 +2805,8 @@ bool LLAppViewer::initCache()
 
 void LLAppViewer::purgeCache()
 {
-	llinfos << "Purging Texture Cache..." << llendl;
+	LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl;
 	LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
-	llinfos << "Purging Cache..." << llendl;
 	std::string mask = gDirUtilp->getDirDelimiter() + "*.*";
 	gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),mask);
 }
@@ -2915,7 +2936,7 @@ void LLAppViewer::badNetworkHandler()
 
 #if LL_WINDOWS
 	// Generates the minidump.
-	LLWinDebug::handleException(NULL);
+	LLWinDebug::generateCrashStacks(NULL);
 #endif
 	LLAppViewer::handleSyncViewerCrash();
 	LLAppViewer::handleViewerCrash();
@@ -3693,3 +3714,19 @@ void LLAppViewer::forceErrorSoftwareException()
     // *FIX: Any way to insure it won't be handled?
     throw; 
 }
+
+void LLAppViewer::startMainloopTimeout(F32 secs)
+{
+	if(secs < 0.0f)
+	{
+		secs = gSavedSettings.getF32("MainloopTimeoutDefault");
+	}
+	
+	mMainloopTimeout->setTimeout(secs);
+	mMainloopTimeout->start();
+}
+
+void LLAppViewer::stopMainloopTimeout()
+{
+	mMainloopTimeout->stop();
+}
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 56dd0efbdd8..de127e5cf8a 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -35,7 +35,7 @@
 class LLTextureCache;
 class LLWorkerThread;
 class LLTextureFetch;
-
+class LLWatchdogTimeout;
 class LLCommandLineParser;
 
 class LLAppViewer : public LLApp
@@ -137,6 +137,11 @@ class LLAppViewer : public LLApp
 
 	std::string getSettingsFileName(const std::string& file);
 
+	// For thread debugging. 
+	// llstartup needs to control this.
+	// llworld, send_agent_pause() also controls this.
+	void startMainloopTimeout(F32 secs = -1.0f);
+	void stopMainloopTimeout();
 
 protected:
 	virtual bool initWindow(); // Initialize the viewer's window.
@@ -207,6 +212,8 @@ class LLAppViewer : public LLApp
     bool mLogoutRequestSent;			// Disconnect message sent to simulator, no longer safe to send messages to the sim.
     S32 mYieldTime;
 	LLSD mSettingsFileList;
+
+	LLWatchdogTimeout* mMainloopTimeout;
 };
 
 // consts from viewer.h
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 28314cb0ae4..f21bdc42430 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -47,7 +47,7 @@
 #include "llfloaterworldmap.h"
 #include "llurldispatcher.h"
 #include <Carbon/Carbon.h>
-
+#include "lldir.h"
 namespace 
 {
 	// The command line args stored.
@@ -197,12 +197,13 @@ void LLAppViewerMacOSX::handleCrashReporting()
 {
 	// Macintosh
 	LLString command_str;
-	command_str = "open crashreporter.app";
+	command_str += "open crashreporter.app";	
+	
+	clear_signals();
+	llinfos << "Launching crash reporter using: '" << command_str << "'" << llendl;
 	system(command_str.c_str());		/* Flawfinder: ignore */
-		
-	// Sometimes signals don't seem to quit the viewer.  
-	// Make sure we exit so as to not totally confuse the user.
-	exit(1);
+	llinfos << "returned from crash reporter... dying" << llendl;	
+	_exit(1);
 }
 
 std::string LLAppViewerMacOSX::generateSerialNumber()
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index fed538da37a..53cc1d3e178 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -79,7 +79,7 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti
 	// Generate a minidump if we can.
 	// Before we wake the error thread...
 	// Which will start the crash reporting.
-	LLWinDebug::handleException(exception_infop);
+	LLWinDebug::generateCrashStacks(exception_infop);
 	
 	// Flag status to error, so thread_error starts its work
 	LLApp::setError();
@@ -119,27 +119,11 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 
 	LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(lpCmdLine);
 
-	// *FIX:Mani This method is poorly named, since the exception
-	// is now handled by LLApp. 
-	bool ok = LLWinDebug::setupExceptionHandler(); 
+	LLWinDebug::initExceptionHandler(viewer_windows_exception_handler); 
 	
-	// Actually here's the exception setup.
-	LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
-	prev_filter = SetUnhandledExceptionFilter(viewer_windows_exception_handler);
-	if (!prev_filter)
-	{
-		llwarns << "Our exception handler (" << (void *)LLWinDebug::handleException << ") replaced with NULL!" << llendl;
-		ok = FALSE;
-	}
-	if (prev_filter != LLWinDebug::handleException)
-	{
-		llwarns << "Our exception handler (" << (void *)LLWinDebug::handleException << ") replaced with " << prev_filter << "!" << llendl;
-		ok = FALSE;
-	}
-
 	viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
 
-	ok = viewer_app_ptr->init();
+	bool ok = viewer_app_ptr->init();
 	if(!ok)
 	{
 		llwarns << "Application init failed." << llendl;
@@ -327,14 +311,14 @@ bool LLAppViewerWin32::initHardwareTest()
 
 		LLSplashScreen::update("Detecting hardware...");
 
-		llinfos << "Attempting to poll DirectX for hardware info" << llendl;
+		LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
 		gDXHardware.setWriteDebugFunc(write_debug_dx);
 		BOOL probe_ok = gDXHardware.getInfo(vram_only);
 
 		if (!probe_ok
 			&& gSavedSettings.getWarning("AboutDirectX9"))
 		{
-			llinfos << "DirectX probe failed, alerting user." << llendl;
+			LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL;
 
 			// Warn them that runnin without DirectX 9 will
 			// not allow us to tell them about driver issues
@@ -355,13 +339,13 @@ bool LLAppViewerWin32::initHardwareTest()
 				OSMB_YESNO);
 			if (OSBTN_NO== button)
 			{
-				llinfos << "User quitting after failed DirectX 9 detection" << llendl;
+				LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
 				LLWeb::loadURLExternal(DIRECTX_9_URL);
 				return false;
 			}
 			gSavedSettings.setWarning("AboutDirectX9", FALSE);
 		}
-		llinfos << "Done polling DirectX for hardware info" << llendl;
+		LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL;
 
 		// Only probe once after installation
 		gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
@@ -373,13 +357,13 @@ bool LLAppViewerWin32::initHardwareTest()
 		LLSplashScreen::update(splash_msg.str().c_str());
 	}
 
-	if (!LLWinDebug::setupExceptionHandler())
+	if (!LLWinDebug::checkExceptionHandler())
 	{
-		llwarns << " Someone took over my exception handler (post hardware probe)!" << llendl;
+		LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL;
 	}
 
 	gGLManager.mVRAM = gDXHardware.getVRAM();
-	llinfos << "Detected VRAM: " << gGLManager.mVRAM << llendl;
+	LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
 
 	return true;
 }
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 4aeb741b2ce..b0dd0a99ac9 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -418,7 +418,7 @@ void LLDrawable::makeStatic(BOOL warning_enabled)
 
 		if (mParent.notNull() && mParent->isActive() && warning_enabled)
 		{
-			llwarns << "Drawable becamse static with active parent!" << llendl;
+			LL_WARNS_ONCE("Drawable") << "Drawable becomes static with active parent!" << LL_ENDL;
 		}
 		
 		S32 child_count = mVObjp->mChildList.size();
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 4d8dbbebacc..17e84296167 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -95,7 +95,7 @@ void LLFeatureList::addFeature(const char *name, const BOOL available, const F32
 {
 	if (mFeatures.count(name))
 	{
-		llwarns << "LLFeatureList::Attempting to add preexisting feature " << name << llendl;
+		LL_WARNS("RenderInit") << "LLFeatureList::Attempting to add preexisting feature " << name << LL_ENDL;
 	}
 
 	LLFeatureInfo fi(name, available, level);
@@ -109,7 +109,7 @@ BOOL LLFeatureList::isFeatureAvailable(const char *name)
 		return mFeatures[name].mAvailable;
 	}
 
-	llwarns << "Feature " << name << " not on feature list!" << llendl;
+	LL_WARNS("RenderInit") << "Feature " << name << " not on feature list!" << LL_ENDL;
 	
 	// changing this to TRUE so you have to explicitly disable 
 	// something for it to be disabled
@@ -123,7 +123,7 @@ F32 LLFeatureList::getRecommendedValue(const char *name)
 		return mFeatures[name].mRecommendedLevel;
 	}
 
-	llwarns << "Feature " << name << " not on feature list or not available!" << llendl;
+	LL_WARNS("RenderInit") << "Feature " << name << " not on feature list or not available!" << LL_ENDL;
 	return 0;
 }
 
@@ -146,46 +146,46 @@ BOOL LLFeatureList::maskList(LLFeatureList &mask)
 		//
 		if (!mFeatures.count(mask_fi.mName))
 		{
-			llwarns << "Feature " << mask_fi.mName << " in mask not in top level!" << llendl;
+			LL_WARNS("RenderInit") << "Feature " << mask_fi.mName << " in mask not in top level!" << LL_ENDL;
 			continue;
 		}
 
 		LLFeatureInfo &cur_fi = mFeatures[mask_fi.mName];
 		if (mask_fi.mAvailable && !cur_fi.mAvailable)
 		{
-			llwarns << "Mask attempting to reenabling disabled feature, ignoring " << cur_fi.mName << llendl;
+			LL_WARNS("RenderInit") << "Mask attempting to reenabling disabled feature, ignoring " << cur_fi.mName << LL_ENDL;
 			continue;
 		}
 		cur_fi.mAvailable = mask_fi.mAvailable;
 		cur_fi.mRecommendedLevel = llmin(cur_fi.mRecommendedLevel, mask_fi.mRecommendedLevel);
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		llinfos << "Feature mask " << mask.mName
+		LL_DEBUGS("RenderInit") << "Feature mask " << mask.mName
 				<< " Feature " << mask_fi.mName
 				<< " Mask: " << mask_fi.mRecommendedLevel
-				<< " Now: " << cur_fi.mRecommendedLevel << llendl;
-#endif
+				<< " Now: " << cur_fi.mRecommendedLevel << LL_ENDL;
 	}
 
-#if 0 && !LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "After applying mask " << mask.mName << llendl;
-	dump();
-#endif
+	LL_DEBUGS("RenderInit") << "After applying mask " << mask.mName << std::endl;
+		// Will conditionally call dump only if the above message will be logged, thanks 
+		// to it being wrapped by the LL_DEBUGS and LL_ENDL macros.
+		dump();
+	LL_CONT << LL_ENDL;
+
 	return TRUE;
 }
 
 void LLFeatureList::dump()
 {
-	llinfos << "Feature list: " << mName << llendl;
-	llinfos << "--------------" << llendl;
+	LL_DEBUGS("RenderInit") << "Feature list: " << mName << LL_ENDL;
+	LL_DEBUGS("RenderInit") << "--------------" << LL_ENDL;
 
 	LLFeatureInfo fi;
 	feature_map_t::iterator feature_it;
 	for (feature_it = mFeatures.begin(); feature_it != mFeatures.end(); ++feature_it)
 	{
 		fi = feature_it->second;
-		llinfos << fi.mName << "\t\t" << fi.mAvailable << ":" << fi.mRecommendedLevel << llendl;
+		LL_DEBUGS("RenderInit") << fi.mName << "\t\t" << fi.mAvailable << ":" << fi.mRecommendedLevel << LL_ENDL;
 	}
-	llinfos << llendl;
+	LL_DEBUGS("RenderInit") << LL_ENDL;
 }
 
 LLFeatureList *LLFeatureManager::findMask(const char *name)
@@ -203,10 +203,10 @@ BOOL LLFeatureManager::maskFeatures(const char *name)
 	LLFeatureList *maskp = findMask(name);
 	if (!maskp)
 	{
-// 		llwarns << "Unknown feature mask " << name << llendl;
+ 		LL_DEBUGS("RenderInit") << "Unknown feature mask " << name << LL_ENDL;
 		return FALSE;
 	}
-	llinfos << "Applying Feature Mask: " << name << llendl;
+	LL_DEBUGS("RenderInit") << "Applying Feature Mask: " << name << LL_ENDL;
 	return maskList(*maskp);
 }
 
@@ -236,7 +236,7 @@ BOOL LLFeatureManager::loadFeatureTables()
 
 	if (!file)
 	{
-		llwarns << "Unable to open feature table!" << llendl;
+		LL_WARNS("RenderInit") << "Unable to open feature table!" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -245,7 +245,7 @@ BOOL LLFeatureManager::loadFeatureTables()
 	file >> version;
 	if (strcmp(name, "version"))
 	{
-		llwarns << data_path << " does not appear to be a valid feature table!" << llendl;
+		LL_WARNS("RenderInit") << data_path << " does not appear to be a valid feature table!" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -285,7 +285,7 @@ BOOL LLFeatureManager::loadFeatureTables()
 			file >> name;
 			if (mMaskList.count(name))
 			{
-				llerrs << "Overriding mask " << name << ", this is invalid!" << llendl;
+				LL_ERRS("RenderInit") << "Overriding mask " << name << ", this is invalid!" << LL_ENDL;
 			}
 
 			flp = new LLFeatureList(name);
@@ -295,7 +295,7 @@ BOOL LLFeatureManager::loadFeatureTables()
 		{
 			if (!flp)
 			{
-				llerrs << "Specified parameter before <list> keyword!" << llendl;
+				LL_ERRS("RenderInit") << "Specified parameter before <list> keyword!" << LL_ENDL;
 			}
 			S32 available;
 			F32 recommended;
@@ -327,7 +327,7 @@ void LLFeatureManager::loadGPUClass()
 
 	if (!file)
 	{
-		llwarns << "Unable to open GPU table: " << data_path << "!" << llendl;
+		LL_WARNS("RenderInit") << "Unable to open GPU table: " << data_path << "!" << LL_ENDL;
 		return;
 	}
 
@@ -398,7 +398,7 @@ void LLFeatureManager::loadGPUClass()
 		{
 			// if we found it, stop!
 			file.close();
-			llinfos << "GPU is " << label << llendl;
+			LL_INFOS("RenderInit") << "GPU is " << label << llendl;
 			mGPUString = label;
 			mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10);
 			mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10);
@@ -408,7 +408,7 @@ void LLFeatureManager::loadGPUClass()
 	}
 	file.close();
 
-	llwarns << "Couldn't match GPU to a class: " << gGLManager.getRawGLString() << llendl;
+	LL_WARNS("RenderInit") << "Couldn't match GPU to a class: " << gGLManager.getRawGLString() << LL_ENDL;
 }
 
 void LLFeatureManager::cleanupFeatureTables()
@@ -546,7 +546,7 @@ void LLFeatureManager::applyBaseMasks()
 	LLFeatureList* maskp = findMask("all");
 	if(maskp == NULL)
 	{
-		llwarns << "AHH! No \"all\" in feature table!" << llendl;
+		LL_WARNS("RenderInit") << "AHH! No \"all\" in feature table!" << LL_ENDL;
 		return;
 	}
 
@@ -563,12 +563,12 @@ void LLFeatureManager::applyBaseMasks()
 			"Class3"
 		};
 
-		llinfos << "Setting GPU Class to " << class_table[mGPUClass] << llendl;
+		LL_INFOS("RenderInit") << "Setting GPU Class to " << class_table[mGPUClass] << LL_ENDL;
 		maskFeatures(class_table[mGPUClass]);
 	}
 	else
 	{
-		llinfos << "Setting GPU Class to Unknown" << llendl;
+		LL_INFOS("RenderInit") << "Setting GPU Class to Unknown" << LL_ENDL;
 		maskFeatures("Unknown");
 	}
 
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index a13431d6835..6a1b5d77584 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -68,6 +68,7 @@ class LLPanelLogin:
 	public LLPanel,
 	public LLWebBrowserCtrlObserver
 {
+	LOG_CLASS(LLPanelLogin);
 public:
 	LLPanelLogin(const LLRect &rect, BOOL show_server, 
 				void (*callback)(S32 option, void* user_data),
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index b8774ceef78..d931e846389 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -265,8 +265,8 @@ namespace
 						  const char* message, const LLSD& body, 
 						  LLHTTPClient::ResponderPtr response) const
 		{
-			llwarns << " attemped to send " << message << " to " << host
-					<< " with null sender" << llendl;
+			LL_WARNS("AppInit") << " attemped to send " << message << " to " << host
+					<< " with null sender" << LL_ENDL;
 		}
 	};
 }
@@ -428,13 +428,13 @@ BOOL idle_startup()
 
 		if (ll_init_ares() == NULL)
 		{
-			llerrs << "Could not start address resolution system" << llendl;
+			LL_ERRS("AppInit") << "Could not start address resolution system" << LL_ENDL;
 		}
 		
 		//
 		// Initialize messaging system
 		//
-		llinfos << "Initializing messaging system..." << llendl;
+		LL_DEBUGS("AppInit") << "Initializing messaging system..." << LL_ENDL;
 
 		std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg");
 
@@ -496,7 +496,7 @@ BOOL idle_startup()
 
 			if (gSavedSettings.getBOOL("LogMessages"))
 			{
-				llinfos << "Message logging activated!" << llendl;
+				LL_DEBUGS("AppInit") << "Message logging activated!" << LL_ENDL;
 				msg->startLogging();
 			}
 
@@ -521,13 +521,13 @@ BOOL idle_startup()
             F32 outBandwidth = gSavedSettings.getF32("OutBandwidth"); 
 			if (inBandwidth != 0.f)
 			{
-				llinfos << "Setting packetring incoming bandwidth to " << inBandwidth << llendl;
+				LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL;
 				msg->mPacketRing.setUseInThrottle(TRUE);
 				msg->mPacketRing.setInBandwidth(inBandwidth);
 			}
 			if (outBandwidth != 0.f)
 			{
-				llinfos << "Setting packetring outgoing bandwidth to " << outBandwidth << llendl;
+				LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL;
 				msg->mPacketRing.setUseOutThrottle(TRUE);
 				msg->mPacketRing.setOutBandwidth(outBandwidth);
 			}
@@ -558,7 +558,7 @@ BOOL idle_startup()
 				BOOL init = gAudiop->init(kAUDIO_NUM_SOURCES, window_handle);
 				if(!init)
 				{
-					llwarns << "Unable to initialize audio engine" << llendl;
+					LL_WARNS("AppInit") << "Unable to initialize audio engine" << LL_ENDL;
 				}
 				gAudiop->setMuted(TRUE);
 			}
@@ -566,7 +566,7 @@ BOOL idle_startup()
 
 		if (LLTimer::knownBadTimer())
 		{
-			llwarns << "Unreliable timers detected (may be bad PCI chipset)!!" << llendl;
+			LL_WARNS("AppInit") << "Unreliable timers detected (may be bad PCI chipset)!!" << LL_ENDL;
 		}
 
 		//
@@ -639,7 +639,7 @@ BOOL idle_startup()
 	//---------------------------------------------------------------------
 	if (STATE_MEDIA_INIT == LLStartUp::getStartupState())
 	{
-		llinfos << "Initializing Multimedia...." << llendl;
+		LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL;
 		set_startup_status(0.03f, "Initializing Multimedia...", gAgent.mMOTD.c_str());
 		display_startup();
 		LLViewerMedia::initClass();
@@ -657,7 +657,7 @@ BOOL idle_startup()
 	if (STATE_LOGIN_SHOW == LLStartUp::getStartupState())
 	{		
 
-		llinfos << "Initializing Window" << llendl;
+		LL_DEBUGS("AppInit") << "Initializing Window" << LL_ENDL;
 		
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
 		// Push our window frontmost
@@ -668,11 +668,13 @@ BOOL idle_startup()
 		if (show_connect_box)
 		{
 			// Load all the name information out of the login view
-			LLPanelLogin::getFields(firstname, lastname, password, remember_password);
+			// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
+			// show the login view until login_show() is called below.  
+			// LLPanelLogin::getFields(firstname, lastname, password, remember_password);
 
 			if (gNoRender)
 			{
-				llerrs << "Need to autologin or use command line with norender!" << llendl;
+				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
 			}
 			// Make sure the process dialog doesn't hide things
 			gViewerWindow->setShowProgress(FALSE);
@@ -765,7 +767,7 @@ BOOL idle_startup()
 			}
 			gSavedSettings.setBOOL("RememberPassword", remember_password);
 
-			llinfos << "Attempting login as: " << firstname << " " << lastname << llendl;
+			LL_INFOS("AppInit") << "Attempting login as: " << firstname << " " << lastname << LL_ENDL;
 			gDebugInfo["LoginName"] = firstname + " " + lastname;	
 		}
 
@@ -911,7 +913,6 @@ BOOL idle_startup()
 		gDebugInfo["GridName"] = gGridInfo[gGridChoice].mLabel;
 
 		// *Note: this is where gUserAuth used to be created.
-
 		requested_options.clear();
 		requested_options.push_back("inventory-root");
 		requested_options.push_back("inventory-skeleton");
@@ -963,7 +964,7 @@ BOOL idle_startup()
 
 	if (STATE_LOGIN_AUTHENTICATE == LLStartUp::getStartupState())
 	{
-		lldebugs << "STATE_LOGIN_AUTHENTICATE" << llendl;
+		LL_DEBUGS("AppInit") << "STATE_LOGIN_AUTHENTICATE" << LL_ENDL;
 		set_startup_status(progress, auth_desc.c_str(), auth_message.c_str());
 		progress += 0.02f;
 		display_startup();
@@ -1023,7 +1024,7 @@ BOOL idle_startup()
 
 	if(STATE_LOGIN_NO_DATA_YET == LLStartUp::getStartupState())
 	{
-		//lldebugs << "STATE_LOGIN_NO_DATA_YET" << llendl;
+		LL_DEBUGS("AppInit") << "STATE_LOGIN_NO_DATA_YET" << LL_ENDL;
 		// If we get here we have gotten past the potential stall
 		// in curl, so take "may appear frozen" out of progress bar. JC
 		auth_desc = "Logging in...";
@@ -1037,7 +1038,7 @@ BOOL idle_startup()
 		LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse();
 		if(LLUserAuth::E_NO_RESPONSE_YET == error)
 		{
-			//llinfos << "waiting..." << llendl;
+			LL_DEBUGS("AppInit") << "waiting..." << LL_ENDL;
 			return do_normal_idle;
 		}
 		LLStartUp::setStartupState( STATE_LOGIN_DOWNLOADING );
@@ -1048,7 +1049,7 @@ BOOL idle_startup()
 
 	if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState())
 	{
-		lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl;
+		LL_DEBUGS("AppInit") << "STATE_LOGIN_DOWNLOADING" << LL_ENDL;
 		// Process messages to keep from dropping circuit.
 		LLMessageSystem* msg = gMessageSystem;
 		while (msg->checkAllMessages(gFrameCount, gServicePump))
@@ -1058,7 +1059,7 @@ BOOL idle_startup()
 		LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse();
 		if(LLUserAuth::E_DOWNLOADING == error)
 		{
-			//llinfos << "downloading..." << llendl;
+			LL_DEBUGS("AppInit") << "downloading..." << LL_ENDL;
 			return do_normal_idle;
 		}
 		LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
@@ -1069,7 +1070,7 @@ BOOL idle_startup()
 
 	if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState())
 	{
-		lldebugs << "STATE_LOGIN_PROCESS_RESPONSE" << llendl;
+		LL_DEBUGS("AppInit") << "STATE_LOGIN_PROCESS_RESPONSE" << LL_ENDL;
 		std::ostringstream emsg;
 		BOOL quit = FALSE;
 		const char* login_response = NULL;
@@ -1091,7 +1092,7 @@ BOOL idle_startup()
 			}
 			else if(login_response && (0 == strcmp(login_response, "indeterminate")))
 			{
-				llinfos << "Indeterminate login..." << llendl;
+				LL_INFOS("AppInit") << "Indeterminate login..." << LL_ENDL;
 				sAuthUris = LLSRV::rewriteURI(LLUserAuth::getInstance()->getResponse("next_url"));
 				sAuthUriNum = 0;
 				auth_method = LLUserAuth::getInstance()->getResponse("next_method");
@@ -1138,7 +1139,7 @@ BOOL idle_startup()
 				{
 					if (show_connect_box)
 					{
-						llinfos << "Need tos agreement" << llendl;
+						LL_DEBUGS("AppInit") << "Need tos agreement" << LL_ENDL;
 						LLStartUp::setStartupState( STATE_UPDATE_CHECK );
 						LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,
 																	message_response);
@@ -1155,7 +1156,7 @@ BOOL idle_startup()
 				{
 					if (show_connect_box)
 					{
-						llinfos << "Need critical message" << llendl;
+						LL_DEBUGS("AppInit") << "Need critical message" << LL_ENDL;
 						LLStartUp::setStartupState( STATE_UPDATE_CHECK );
 						LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE,
 																	message_response);
@@ -1190,7 +1191,7 @@ BOOL idle_startup()
 				}
 				if(reason_response && (0 == strcmp(reason_response, "optional")))
 				{
-					llinfos << "Login got optional update" << llendl;
+					LL_DEBUGS("AppInit") << "Login got optional update" << LL_ENDL;
 					auth_message = LLUserAuth::getInstance()->getResponse("message");
 					if (show_connect_box)
 					{
@@ -1453,8 +1454,8 @@ BOOL idle_startup()
 			{
 				if (gNoRender)
 				{
-					llinfos << "Bad login - missing return values" << llendl;
-					llinfos << emsg << llendl;
+					LL_WARNS("AppInit") << "Bad login - missing return values" << LL_ENDL;
+					LL_WARNS("AppInit") << emsg << LL_ENDL;
 					exit(0);
 				}
 				// Bounce back to the login screen.
@@ -1473,8 +1474,8 @@ BOOL idle_startup()
 		{
 			if (gNoRender)
 			{
-				llinfos << "Failed to login!" << llendl;
-				llinfos << emsg << llendl;
+				LL_WARNS("AppInit") << "Failed to login!" << LL_ENDL;
+				LL_WARNS("AppInit") << emsg << LL_ENDL;
 				exit(0);
 			}
 			// Bounce back to the login screen.
@@ -1543,11 +1544,11 @@ BOOL idle_startup()
 		LLWorld::getInstance()->addRegion(first_sim_handle, first_sim);
 
 		LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(first_sim_handle);
-		llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl;
+		LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL;
 		
 		LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
 		regionp->setSeedCapability(first_sim_seed_cap);
-		llinfos << "Waiting for seed grant ...." << llendl;
+		LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL;
 		
 		// Set agent's initial region to be the one we just created.
 		gAgent.setRegion(regionp);
@@ -1615,7 +1616,7 @@ BOOL idle_startup()
 		//
 		// Set message handlers
 		//
-		llinfos << "Initializing communications..." << llendl;
+		LL_INFOS("AppInit") << "Initializing communications..." << LL_ENDL;
 
 		// register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
 		register_viewer_callbacks(gMessageSystem);
@@ -1664,7 +1665,7 @@ BOOL idle_startup()
 
 		// Sets up the parameters for the first simulator
 
-		llinfos << "Initializing camera..." << llendl;
+		LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
 		gFrameTime    = totalTime();
 		F32 last_time = gFrameTimeSeconds;
 		gFrameTimeSeconds = (S64)(gFrameTime - gStartTime)/SEC_TO_MICROSEC;
@@ -1699,12 +1700,12 @@ BOOL idle_startup()
 		// Initialize global class data needed for surfaces (i.e. textures)
 		if (!gNoRender)
 		{
-			llinfos << "Initializing sky..." << llendl;
+			LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
 			// Initialize all of the viewer object classes for the first time (doing things like texture fetches.
 			gSky.init(initial_sun_direction);
 		}
 
-		llinfos << "Decoding images..." << llendl;
+		LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL;
 		// For all images pre-loaded into viewer cache, decode them.
 		// Need to do this AFTER we init the sky
 		const S32 DECODE_TIME_SEC = 2;
@@ -1722,14 +1723,14 @@ BOOL idle_startup()
 		LLMessageSystem* msg = gMessageSystem;
 		if (!msg->mOurCircuitCode)
 		{
-			llwarns << "Attempting to connect to simulator with a zero circuit code!" << llendl;
+			LL_WARNS("AppInit") << "Attempting to connect to simulator with a zero circuit code!" << LL_ENDL;
 		}
 
 		gUseCircuitCallbackCalled = FALSE;
 
 		msg->enableCircuit(first_sim, TRUE);
 		// now, use the circuit info to tell simulator about us!
-		llinfos << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << llendl;
+		LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << LL_ENDL;
 		msg->newMessageFast(_PREHASH_UseCircuitCode);
 		msg->nextBlockFast(_PREHASH_CircuitCode);
 		msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode);
@@ -1755,7 +1756,7 @@ BOOL idle_startup()
 	//---------------------------------------------------------------------
 	if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
 	{
-		//llinfos << "Waiting for simulator ack...." << llendl;
+		LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL;
 		set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake").c_str(), gAgent.mMOTD.c_str());
 		if(gGotUseCircuitCodeAck)
 		{
@@ -1774,7 +1775,7 @@ BOOL idle_startup()
 	//---------------------------------------------------------------------
 	if (STATE_AGENT_SEND == LLStartUp::getStartupState())
 	{
-		llinfos << "Connecting to region..." << llendl;
+		LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
 		set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion").c_str(), gAgent.mMOTD.c_str());
 		// register with the message system so it knows we're
 		// expecting this message
@@ -1826,8 +1827,8 @@ BOOL idle_startup()
 			}
 			else
 			{
-				//llinfos << "Awaiting AvatarInitComplete, got "
-				//<< msg->getMessageName() << llendl;
+				LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
+				<< msg->getMessageName() << LL_ENDL;
 			}
 		}
 		msg->processAcks();
@@ -1879,7 +1880,7 @@ BOOL idle_startup()
  		{
  			if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner))
  			{
- 				llwarns << "Problem loading inventory-skel-lib" << llendl;
+ 				LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL;
  			}
  		}
  		options.clear();
@@ -1887,8 +1888,7 @@ BOOL idle_startup()
  		{
  			if(!gInventory.loadSkeleton(options, gAgent.getID()))
  			{
- 				llwarns << "Problem loading inventory-skel-targets"
-						<< llendl;
+ 				LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL;
  			}
  		}
 
@@ -2040,17 +2040,17 @@ BOOL idle_startup()
 			if (rate_bps > FASTER_RATE_BPS
 				&& rate_bps > max_bandwidth)
 			{
-				llinfos << "Fast network connection, increasing max bandwidth to " 
+				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
 					<< FASTER_RATE_BPS/1024.f 
-					<< " kbps" << llendl;
+					<< " kbps" << LL_ENDL;
 				gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
 			}
 			else if (rate_bps > FAST_RATE_BPS
 				&& rate_bps > max_bandwidth)
 			{
-				llinfos << "Fast network connection, increasing max bandwidth to " 
+				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
 					<< FAST_RATE_BPS/1024.f 
-					<< " kbps" << llendl;
+					<< " kbps" << LL_ENDL;
 				gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
 			}
 		}
@@ -2082,8 +2082,8 @@ BOOL idle_startup()
 			LLUserAuth::options_t gesture_options;
 			if (LLUserAuth::getInstance()->getOptions("gestures", gesture_options))
 			{
-				llinfos << "Gesture Manager loading " << gesture_options.size()
-					<< llendl;
+				LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
+					<< LL_ENDL;
 				std::vector<LLUUID> item_ids;
 				LLUserAuth::options_t::iterator resp_it;
 				for (resp_it = gesture_options.begin();
@@ -2136,7 +2136,7 @@ BOOL idle_startup()
 		msg->setHandlerFuncFast(_PREHASH_AttachedSound,				process_attached_sound);
 		msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange,	process_attached_sound_gain_change);
 
-		llinfos << "Initialization complete" << llendl;
+		LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
 
 		gRenderStartTime.reset();
 		gForegroundTime.reset();
@@ -2273,7 +2273,7 @@ BOOL idle_startup()
 		gViewerWindow->showCursor();
 		gViewerWindow->getWindow()->resetBusyCount();
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
-		//llinfos << "Done releasing bitmap" << llendl;
+		LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL;
 		gViewerWindow->setShowProgress(FALSE);
 		gViewerWindow->setProgressCancelButtonVisible(FALSE, "");
 
@@ -2295,7 +2295,7 @@ BOOL idle_startup()
 		if (gSavedSettings.getBOOL("StatsAutoRun"))
 		{
 			LLUUID id;
-			llinfos << "Starting automatic playback" << llendl;
+			LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
 			gAgentPilot.startPlayback();
 		}
 
@@ -2311,9 +2311,9 @@ BOOL idle_startup()
 		// Unmute audio if desired and setup volumes.
 		// This is a not-uncommon crash site, so surround it with
 		// llinfos output to aid diagnosis.
-		llinfos << "Doing first audio_update_volume..." << llendl;
+		LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL;
 		audio_update_volume();
-		llinfos << "Done first audio_update_volume." << llendl;
+		LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL;
 
 		// reset keyboard focus to sane state of pointing at world
 		gFocusMgr.setKeyboardFocus(NULL);
@@ -2322,10 +2322,12 @@ BOOL idle_startup()
 		gDebugView->mFastTimerView->setVisible(TRUE);
 #endif
 
+		LLAppViewer::instance()->startMainloopTimeout();
+
 		return do_normal_idle;
 	}
 
-	llwarns << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << llendl;
+	LL_WARNS("AppInit") << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << LL_ENDL;
 	return do_normal_idle;
 }
 
@@ -2335,7 +2337,7 @@ BOOL idle_startup()
 
 void login_show()
 {
-	llinfos << "Initializing Login Screen" << llendl;
+	LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL;
 
 #ifdef LL_RELEASE_FOR_DOWNLOAD
 	BOOL bUseDebugLogin = gSavedSettings.getBOOL("UseDebugLogin");
@@ -2349,7 +2351,7 @@ void login_show()
 
 	// UI textures have been previously loaded in doPreloadImages()
 	
-	llinfos << "Setting Servers" << llendl;
+	LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
 
 	if( GRID_INFO_OTHER == gGridChoice )
 	{
@@ -2418,7 +2420,7 @@ void login_callback(S32 option, void *userdata)
 	}
 	else
 	{
-		llwarns << "Unknown login button clicked" << llendl;
+		LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL;
 	}
 }
 
@@ -2503,7 +2505,7 @@ void save_password_to_disk(const char* hashed_password)
 
 		if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
 		{
-			llwarns << "Short write" << llendl;
+			LL_WARNS("AppInit") << "Short write" << LL_ENDL;
 		}
 
 		fclose(fp);
@@ -2553,7 +2555,7 @@ void first_run_dialog_callback(S32 option, void* userdata)
 {
 	if (0 == option)
 	{
-		llinfos << "First run dialog cancelling" << llendl;
+		LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
 		LLWeb::loadURL( CREATE_ACCOUNT_URL );
 	}
 
@@ -2586,7 +2588,7 @@ void login_alert_status(S32 option, void* user_data)
             LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
             break;
         default:
-            llwarns << "Missing case in login_alert_status switch" << llendl;
+            LL_WARNS("AppInit") << "Missing case in login_alert_status switch" << LL_ENDL;
     }
 
 	LLPanelLogin::giveFocus();
@@ -2704,7 +2706,7 @@ void update_dialog_callback(S32 option, void *userdata)
 	if (update_exe_path.empty())
 	{
 		// We're hosed, bail
-		llwarns << "LLDir::getTempFilename() failed" << llendl;
+		LL_WARNS("AppInit") << "LLDir::getTempFilename() failed" << LL_ENDL;
 		LLAppViewer::instance()->forceQuit();
 		return;
 	}
@@ -2715,14 +2717,14 @@ void update_dialog_callback(S32 option, void *userdata)
 	updater_source += gDirUtilp->getDirDelimiter();
 	updater_source += "updater.exe";
 
-	llinfos << "Calling CopyFile source: " << updater_source.c_str()
+	LL_DEBUGS("AppInit") << "Calling CopyFile source: " << updater_source.c_str()
 			<< " dest: " << update_exe_path
-			<< llendl;
+			<< LL_ENDL;
 
 
 	if (!CopyFileA(updater_source.c_str(), update_exe_path.c_str(), FALSE))
 	{
-		llinfos << "Unable to copy the updater!" << llendl;
+		LL_WARNS("AppInit") << "Unable to copy the updater!" << LL_ENDL;
 		LLAppViewer::instance()->forceQuit();
 		return;
 	}
@@ -2760,14 +2762,14 @@ void update_dialog_callback(S32 option, void *userdata)
 		params << " -program \"" << program_name << "\"";
 	}
 
-	llinfos << "Calling updater: " << update_exe_path << " " << params.str() << llendl;
+	LL_DEBUGS("AppInit") << "Calling updater: " << update_exe_path << " " << params.str() << LL_ENDL;
 
 	//Explicitly remove the marker file, otherwise we pass the lock onto the child process and things get weird.
 	LLAppViewer::instance()->removeMarkerFile(); // In case updater fails
 	
 	// Use spawn() to run asynchronously
 	int retval = _spawnl(_P_NOWAIT, update_exe_path.c_str(), update_exe_path.c_str(), params.str().c_str(), NULL);
-	llinfos << "Spawn returned " << retval << llendl;
+	LL_DEBUGS("AppInit") << "Spawn returned " << retval << LL_ENDL;
 
 #elif LL_DARWIN
 	// if a sim name was passed in via command line parameter (typically through a SLURL)
@@ -2785,7 +2787,7 @@ void update_dialog_callback(S32 option, void *userdata)
 	update_exe_path += LLAppViewer::instance()->getSecondLifeTitle();
 	update_exe_path += "\" &";
 
-	llinfos << "Calling updater: " << update_exe_path << llendl;
+	LL_DEBUGS("AppInit") << "Calling updater: " << update_exe_path << LL_ENDL;
 	
 	// *REMOVE:Mani The following call is handled through ~LLAppViewer.
  	// remove_marker_file(); // In case updater fails
@@ -2815,7 +2817,7 @@ void use_circuit_callback(void**, S32 result)
 		if (result)
 		{
 			// Make sure user knows something bad happened. JC
-			llinfos << "Backing up to login screen!" << llendl;
+			LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
 			gViewerWindow->alertXml("LoginPacketNeverReceived",
 				login_alert_status, NULL);
 			reset_login();
@@ -3662,10 +3664,10 @@ void init_start_screen(S32 location_id)
 	if (gStartImageGL.notNull())
 	{
 		gStartImageGL = NULL;
-		llinfos << "re-initializing start screen" << llendl;
+		LL_INFOS("AppInit") << "re-initializing start screen" << LL_ENDL;
 	}
 
-	llinfos << "Loading startup bitmap..." << llendl;
+	LL_DEBUGS("AppInit") << "Loading startup bitmap..." << LL_ENDL;
 
 	LLString temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter();
 
@@ -3684,12 +3686,12 @@ void init_start_screen(S32 location_id)
 	// driver bug
 	if(!gSavedSettings.getBOOL("UseStartScreen"))
 	{
-		llinfos << "Bitmap load disabled" << llendl;
+		LL_INFOS("AppInit")  << "Bitmap load disabled" << LL_ENDL;
 		return;
 	}
 	else if(!start_image_bmp->load(temp_str) )
 	{
-		llinfos << "Bitmap load failed" << llendl;
+		LL_WARNS("AppInit") << "Bitmap load failed" << LL_ENDL;
 		return;
 	}
 
@@ -3700,7 +3702,7 @@ void init_start_screen(S32 location_id)
 	LLPointer<LLImageRaw> raw = new LLImageRaw;
 	if (!start_image_bmp->decode(raw, 0.0f))
 	{
-		llinfos << "Bitmap decode failed" << llendl;
+		LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
 		gStartImageGL = NULL;
 		return;
 	}
@@ -3713,7 +3715,7 @@ void init_start_screen(S32 location_id)
 // frees the bitmap
 void release_start_screen()
 {
-	//llinfos << "Releasing bitmap..." << llendl;
+	LL_DEBUGS("AppInit") << "Releasing bitmap..." << LL_ENDL;
 	gStartImageGL = NULL;
 }
 
@@ -3721,7 +3723,7 @@ void release_start_screen()
 // static
 void LLStartUp::setStartupState( S32 state )
 {
-	llinfos << "Startup state changing from " << gStartupState << " to " << state << llendl;
+	LL_INFOS("AppInit") << "Startup state changing from " << gStartupState << " to " << state << LL_ENDL;
 	gStartupState = state;
 }
 
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 6aba05a7889..534d19874ca 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1023,8 +1023,8 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL read_only)
 		sCacheMaxTexturesSize = max_size;
 	max_size -= sCacheMaxTexturesSize;
 	
-	llinfos << "TEXTURE CACHE: Headers: " << sCacheMaxEntries
-			<< " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << llendl;
+	LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries
+			<< " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << LL_ENDL;
 
 	setDirNames(location);
 	
@@ -1161,7 +1161,7 @@ void LLTextureCache::purgeTextures(bool validate)
 	S32 num_entries = filesize / sizeof(Entry);
 	if (num_entries * (S32)sizeof(Entry) != filesize)
 	{
-		llwarns << "Bad cache file: " << mTexturesDirEntriesFileName << " Purging." << llendl;
+		LL_WARNS("TextureCache") << "Bad cache file: " << mTexturesDirEntriesFileName << " Purging." << LL_ENDL;
 		purgeAllTextures(false);
 		return;
 	}
@@ -1175,19 +1175,19 @@ void LLTextureCache::purgeTextures(bool validate)
 										 (U8*)entries, 0, num_entries*sizeof(Entry));
 	if (bytes_read != filesize)
 	{
-		llwarns << "Bad cache file (2): " << mTexturesDirEntriesFileName << " Purging." << llendl;
+		LL_WARNS("TextureCache") << "Bad cache file (2): " << mTexturesDirEntriesFileName << " Purging." << LL_ENDL;
 		purgeAllTextures(false);
 		return;
 	}
 	
-	llinfos << "TEXTURE CACHE: Reading Entries..." << llendl;
+	LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Reading Entries..." << LL_ENDL;
 	
 	std::map<LLUUID, S32> entry_idx_map;
 	S64 total_size = 0;
 	for (S32 idx=0; idx<num_entries; idx++)
 	{
 		const LLUUID& id = entries[idx].mID;
-// 		llinfos << "Entry: " << id << " Size: " << entries[i].mSize << " Time: " << entries[i].mTime << llendl;
+ 		LL_DEBUGS("TextureCache") << "Entry: " << id << " Size: " << entries[idx].mSize << " Time: " << entries[idx].mTime << LL_ENDL;
 		std::map<LLUUID, S32>::iterator iter = entry_idx_map.find(id);
 		if (iter != entry_idx_map.end())
 		{
@@ -1206,7 +1206,7 @@ void LLTextureCache::purgeTextures(bool validate)
 		validate_idx = gSavedSettings.getU32("CacheValidateCounter");
 		U32 next_idx = (++validate_idx) % 256;
 		gSavedSettings.setU32("CacheValidateCounter", next_idx);
-		llinfos << "TEXTURE CACHE: Validating: " << validate_idx << llendl;
+		LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Validating: " << validate_idx << LL_ENDL;
 	}
 	
 	S64 min_cache_size = (sCacheMaxTexturesSize * 9) / 10;
@@ -1230,12 +1230,12 @@ void LLTextureCache::purgeTextures(bool validate)
 			S32 uuididx = entries[idx].mID.mData[0];
 			if (uuididx == validate_idx)
 			{
-// 				llinfos << "Validating: " << filename << "Size: " << entries[idx].mSize << llendl;
+ 				LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mSize << LL_ENDL;
 				S32 bodysize = ll_apr_file_size(filename, NULL);
 				if (bodysize != entries[idx].mSize)
 				{
-					llwarns << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mSize
-							<< filename << llendl;
+					LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mSize
+							<< filename << LL_ENDL;
 					purge_entry = true;
 				}
 			}
@@ -1243,7 +1243,7 @@ void LLTextureCache::purgeTextures(bool validate)
 		if (purge_entry)
 		{
 			purge_count++;
-//	 		llinfos << "PURGING: " << filename << llendl;
+	 		LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
 			ll_apr_file_remove(filename, NULL);
 			total_size -= entries[idx].mSize;
 			entries[idx].mSize = 0;
@@ -1259,7 +1259,7 @@ void LLTextureCache::purgeTextures(bool validate)
 	}
 	num_entries = next_idx;
 
-	llinfos << "TEXTURE CACHE: Writing Entries: " << num_entries << llendl;
+	LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Writing Entries: " << num_entries << LL_ENDL;
 	
 	ll_apr_file_remove(mTexturesDirEntriesFileName, NULL);
 	ll_apr_file_write_ex(mTexturesDirEntriesFileName, NULL,
@@ -1276,7 +1276,7 @@ void LLTextureCache::purgeTextures(bool validate)
 	
 	delete[] entries;
 	
-	llinfos << "TEXTURE CACHE:"
+	LL_INFOS("TextureCache") << "TEXTURE CACHE:"
 			<< " PURGED: " << purge_count
 			<< " ENTRIES: " << num_entries
 			<< " CACHE SIZE: " << total_size / 1024*1024 << " MB"
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index ce23efe2f01..19035e8fc80 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -870,9 +870,9 @@ void LLViewerJointMesh::updateVectorize()
 		case 1: vp = "SSE"; break;
 		default: vp = "COMPILER DEFAULT"; break;
 	}
-	llinfos << "Vectorization         : " << ( vectorizeEnable ? "ENABLED" : "DISABLED" ) << llendl ;
-	llinfos << "Vector Processor      : " << vp << llendl ;
-	llinfos << "Vectorized Skinning   : " << ( vectorizeSkin ? "ENABLED" : "DISABLED" ) << llendl ;
+	LL_INFOS("AppInit") << "Vectorization         : " << ( vectorizeEnable ? "ENABLED" : "DISABLED" ) << LL_ENDL ;
+	LL_INFOS("AppInit") << "Vector Processor      : " << vp << LL_ENDL ;
+	LL_INFOS("AppInit") << "Vectorized Skinning   : " << ( vectorizeSkin ? "ENABLED" : "DISABLED" ) << LL_ENDL ;
 	if(vectorizeEnable && vectorizeSkin)
 	{
 		switch(sVectorizeProcessor)
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index f7b9d2dc93b..fd2a906eddb 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1096,7 +1096,9 @@ void init_client_menu(LLMenuGL* menu)
 	{
 		LLMenuGL* sub = NULL;
 		sub = new LLMenuGL("Debugging");
+#if LL_WINDOWS
         sub->append(new LLMenuItemCallGL("Force Breakpoint", &force_error_breakpoint, NULL, NULL, 'B', MASK_CONTROL | MASK_ALT));
+#endif
 		sub->append(new LLMenuItemCallGL("Force LLError And Crash", &force_error_llerror));
         sub->append(new LLMenuItemCallGL("Force Bad Memory Access", &force_error_bad_memory_access));
 		sub->append(new LLMenuItemCallGL("Force Infinite Loop", &force_error_infinite_loop));
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3b2b82e1f9e..391a5ad5cb0 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -202,7 +202,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_
 {
 	if(0 == amount) return;
 	amount = abs(amount);
-	llinfos << "give_money(" << uuid << "," << amount << ")"<< llendl;
+	LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL;
 	if(can_afford_transaction(amount))
 	{
 //		gStatusBar->debitBalance(amount);
@@ -242,7 +242,7 @@ void send_complete_agent_movement(const LLHost& sim_host)
 void process_logout_reply(LLMessageSystem* msg, void**)
 {
 	// The server has told us it's ok to quit.
-	llinfos << "process_logout_reply" << llendl;
+	LL_DEBUGS("Messaging") << "process_logout_reply" << LL_ENDL;
 
 	LLUUID agent_id;
 	msg->getUUID("AgentData", "AgentID", agent_id);
@@ -250,7 +250,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
 	msg->getUUID("AgentData", "SessionID", session_id);
 	if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID()))
 	{
-		llwarns << "Bogus Logout Reply" << llendl;
+		LL_WARNS("Messaging") << "Bogus Logout Reply" << LL_ENDL;
 	}
 
 	LLInventoryModel::update_map_t parents;
@@ -268,7 +268,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
 
 		// We do not need to track the asset ids, just account for an
 		// updated inventory version.
-		llinfos << "process_logout_reply itemID=" << item_id << llendl;
+		LL_INFOS("Messaging") << "process_logout_reply itemID=" << item_id << LL_ENDL;
 		LLInventoryItem* item = gInventory.getItem( item_id );
 		if( item )
 		{
@@ -277,7 +277,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
 		}
 		else
 		{
-			llinfos << "process_logout_reply item not found: " << item_id << llendl;
+			LL_INFOS("Messaging") << "process_logout_reply item not found: " << item_id << LL_ENDL;
 		}
 	}
     LLAppViewer::instance()->forceQuit();
@@ -300,15 +300,15 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
 	size = mesgsys->getSizeFast(_PREHASH_LayerData, _PREHASH_Data);
 	if (0 == size)
 	{
-		llwarns << "Layer data has zero size." << llendl;
+		LL_WARNS("Messaging") << "Layer data has zero size." << LL_ENDL;
 		return;
 	}
 	if (size < 0)
 	{
 		// getSizeFast() is probably trying to tell us about an error
-		llwarns << "getSizeFast() returned negative result: "
+		LL_WARNS("Messaging") << "getSizeFast() returned negative result: "
 			<< size
-			<< llendl;
+			<< LL_ENDL;
 		return;
 	}
 	U8 *datap = new U8[size];
@@ -353,7 +353,7 @@ void export_complete()
 		size_t nread = fread(buffer, 1, length, fXML);
 		if (nread < (size_t) length)
 		{
-			llwarns << "Short read" << llendl;
+			LL_WARNS("Messaging") << "Short read" << LL_ENDL;
 		}
 		buffer[nread] = '\0';
 		fclose(fXML);
@@ -375,12 +375,12 @@ void export_complete()
 					
 					LLUUID image_uuid(image_uuid_str);
 
-					llinfos << "Found UUID: " << image_uuid << llendl;
+					LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL;
 
 					std::map<LLUUID, LLString>::iterator itor = gImageChecksums.find(image_uuid);
 					if (itor != gImageChecksums.end())
 					{
-						llinfos << "Replacing with checksum: " << itor->second << llendl;
+						LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL;
 						if (itor->second.c_str() != NULL)
 							{
 								memcpy(&pos_check[10], itor->second.c_str(), 32);		/* Flawfinder: ignore */
@@ -393,7 +393,7 @@ void export_complete()
 		LLFILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb");		/* Flawfinder: ignore */
 		if (fwrite(buffer, 1, length, fXMLOut) != length)
 		{
-			llwarns << "Short write" << llendl;
+			LL_WARNS("Messaging") << "Short write" << LL_ENDL;
 		}
 		fclose(fXMLOut);
 
@@ -407,14 +407,14 @@ void exported_item_complete(const LLTSCode status, void *user_data)
 
 	if (status < LLTS_OK)
 	{
-		llinfos << "Export failed!" << llendl;
+		LL_WARNS("Messaging") << "Export failed!" << LL_ENDL;
 	}
 	else
 	{
 		++current_object_count;
 		if (current_image_count == exported_image_count && current_object_count == exported_object_count)
 		{
-			llinfos << "*** Export complete ***" << llendl;
+			LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL;
 
 			export_complete();
 		}
@@ -442,7 +442,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data)
 
 	if (status < LLTS_OK)
 	{
-		llinfos << "Image download failed!" << llendl;
+		LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL;
 	}
 	else
 	{
@@ -458,7 +458,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data)
 			U8 *buffer = ImageUtility->allocateData(length);
 			if (fread(buffer, 1, length, fIn) != length)
 			{
-				llwarns << "Short read" << llendl;
+				LL_WARNS("Messaging") << "Short read" << LL_ENDL;
 			}
 			fclose(fIn);
 			LLFile::remove(filename.c_str());
@@ -488,7 +488,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data)
 			{
 				if (fwrite(data, 1, data_size, fOut) != data_size)
 				{
-					llwarns << "Short write" << llendl;
+					LL_WARNS("Messaging") << "Short write" << LL_ENDL;
 				}
 				fseek(fOut, 0, SEEK_SET);
 				fclose(fOut);
@@ -504,7 +504,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data)
 	++current_image_count;
 	if (current_image_count == exported_image_count && current_object_count == exported_object_count)
 	{
-		llinfos << "*** Export textures complete ***" << llendl;
+		LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL;
 			export_complete();
 	}
 	else
@@ -533,7 +533,7 @@ void process_places_reply(LLMessageSystem* msg, void** data)
 	}
 	else
 	{
-		llwarns << "Got invalid PlacesReply message" << llendl;
+		LL_WARNS("Messaging") << "Got invalid PlacesReply message" << LL_ENDL;
 	}
 }
 
@@ -705,7 +705,7 @@ class LLDiscardAgentOffer : public LLInventoryFetchComboObserver
 	virtual ~LLDiscardAgentOffer() {}
 	virtual void done()
 	{
-		lldebugs << "LLDiscardAgentOffer::done()" << llendl;
+		LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL;
 		LLUUID trash_id;
 		trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH);
 		bool notify = false;
@@ -729,9 +729,9 @@ class LLDiscardAgentOffer : public LLInventoryFetchComboObserver
 		}
 		else
 		{
-			llwarns << "DiscardAgentOffer unable to find: "
+			LL_WARNS("Messaging") << "DiscardAgentOffer unable to find: "
 					<< (trash_id.isNull() ? "trash " : "")
-					<< (mObjectID.isNull() ? "object" : "") << llendl;
+					<< (mObjectID.isNull() ? "object" : "") << LL_ENDL;
 		}
 		gInventory.removeObserver(this);
 		if(notify)
@@ -766,14 +766,14 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 	
 	if(gThrottleTimer.checkExpirationAndReset(OFFER_THROTTLE_TIME))
 	{
-		//llinfos << "Throttle Expired" << llendl;
+		LL_DEBUGS("Messaging") << "Throttle Expired" << LL_ENDL;
 		throttle_count=1;
 		throttle_logged=false;
 		return true;
 	}
 	else //has not expired
 	{
-		//llinfos << "Throttle Not Expired, Count: " << throttle_count << llendl;
+		LL_DEBUGS("Messaging") << "Throttle Not Expired, Count: " << throttle_count << LL_ENDL;
 		// When downloading the initial inventory we get a lot of new items
 		// coming in and can't tell that from spam.  JC
 		if (LLStartUp::getStartupState() >= STATE_STARTED
@@ -821,7 +821,7 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
 		item = gInventory.getItem(*it);
 		if(!item)
 		{
-			llwarns << "Unable to show inventory item: " << *it << llendl;
+			LL_WARNS("Messaging") << "Unable to show inventory item: " << *it << LL_ENDL;
 			continue;
 		}
 		if(gInventory.isObjectDescendentOf(*it, trash_id))
@@ -880,7 +880,7 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
 		//don't dick with highlight while the user is working
 		//if(inventory_has_focus && !user_is_away)
 		//	break;
-		//llinfos << "Highlighting" << item->getUUID()  << llendl;
+		LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID()  << LL_ENDL;
 		//highlight item
 
 		LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus();
@@ -1041,8 +1041,8 @@ void inventory_offer_callback(S32 button, void* user_data)
 		}
 
 		// we will want to open this item when it comes back.
-		lldebugs << "Initializing an opener for tid: " << info->mTransactionID
-				 << llendl;
+		LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << info->mTransactionID
+				 << LL_ENDL;
 		switch (info->mIM)
 		{
 		case IM_INVENTORY_OFFERED:
@@ -1075,7 +1075,7 @@ void inventory_offer_callback(S32 button, void* user_data)
 		}
 		break;
 		default:
-			llwarns << "inventory_offer_callback: unknown offer type" << llendl;
+			LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
 			break;
 		}	// end switch (info->mIM)
 		break;
@@ -1187,11 +1187,11 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
 	}
 	else
 	{
-		llwarns << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << llendl;
+		LL_WARNS("Messaging") << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << LL_ENDL;
 		args["[OBJECTTYPE]"] = "";
 
 		// This seems safest, rather than propagating bogosity
-		llwarns << "Forcing an inventory-decline for probably-bad asset type." << llendl;
+		LL_WARNS("Messaging") << "Forcing an inventory-decline for probably-bad asset type." << LL_ENDL;
 		inventory_offer_callback(IOR_DECLINE, info);
 		return;
 	}
@@ -1424,7 +1424,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 			snprintf(buffer, sizeof(buffer), "%s%s", separator_string, (message+message_offset));		/* Flawfinder: ignore */
 	
-			llinfos << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << llendl;
+			LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 
 			// add to IM panel, but do not bother the user
 			gIMMgr->addMessage(
@@ -1480,7 +1480,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			snprintf(buffer, sizeof(buffer), "%s%s%s", separator_string, saved,(message+message_offset));		/* Flawfinder: ignore */
 
-			llinfos << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << llendl;
+			LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 
 			if (!is_muted || is_linden)
 			{
@@ -1538,7 +1538,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	case IM_GROUP_NOTICE:
 	case IM_GROUP_NOTICE_REQUESTED:
 		{
-			llinfos << "Received IM_GROUP_NOTICE message." << llendl;
+			LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
 			// Read the binary bucket for more information.
 			struct notice_bucket_header_t
 			{
@@ -1557,7 +1557,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			if ( (binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
 				|| (binary_bucket[binary_bucket_size - 1] != '\0') )
 			{
-				llwarns << "Malformed group notice binary bucket" << llendl;
+				LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
 				break;
 			}
 
@@ -1623,7 +1623,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			else
 			{
-				llinfos << "Received IM_GROUP_INVITATION message." << llendl;
+				LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL;
 				// Read the binary bucket for more information.
 				struct invite_bucket_t
 				{
@@ -1634,7 +1634,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				// Make sure the binary bucket is the correct size.
 				if (binary_bucket_size != sizeof(invite_bucket_t))
 				{
-					llwarns << "Malformed group invite binary bucket" << llendl;
+					LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL;
 					break;
 				}
 
@@ -1673,7 +1673,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 				if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
 				{
-					llwarns << "Malformed inventory offer from agent" << llendl;
+					LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL;
 					break;
 				}
 				bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
@@ -1684,7 +1684,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			{
 				if (sizeof(S8) != binary_bucket_size)
 				{
-					llwarns << "Malformed inventory offer from object" << llendl;
+					LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL;
 					break;
 				}
 				info->mType = (LLAssetType::EType) binary_bucket[0];
@@ -1745,7 +1745,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 	case IM_GROUP_ELECTION_DEPRECATED:
 	{
-		llwarns << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << llendl;
+		LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL;
 	}
 	break;
 	
@@ -1825,7 +1825,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	case IM_BUSY_AUTO_RESPONSE:
 		if (is_muted)
 		{
-			lldebugs << "Ignoring busy response from " << from_id << llendl;
+			LL_DEBUGS("Messaging") << "Ignoring busy response from " << from_id << LL_ENDL;
 			return;
 		}
 		else
@@ -1873,16 +1873,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			// URLs sent by scripts (i.e. llLoadURL)
 			if (binary_bucket_size <= 0)
 			{
-				llwarns << "bad binary_bucket_size: "
+				LL_WARNS("Messaging") << "bad binary_bucket_size: "
 					<< binary_bucket_size
-					<< " - aborting function." << llendl;
+					<< " - aborting function." << LL_ENDL;
 				return;
 			}
 
 			char* url = new char[binary_bucket_size];
 			if (url == NULL)
 			{
-				llerrs << "Memory Allocation failed" << llendl;
+				LL_ERRS("Messaging") << "Memory Allocation failed" << LL_ENDL;
 				return;
 			}
 
@@ -1943,8 +1943,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 		break;
 
 	default:
-		llwarns << "Instant message calling for unknown dialog "
-				<< (S32)dialog << llendl;
+		LL_WARNS("Messaging") << "Instant message calling for unknown dialog "
+				<< (S32)dialog << LL_ENDL;
 		break;
 	}
 
@@ -2072,7 +2072,7 @@ void callingcard_offer_callback(S32 option, void* user_data)
 void process_offer_callingcard(LLMessageSystem* msg, void**)
 {
 	// someone has offered to form a friendship
-	lldebugs << "callingcard offer" << llendl;
+	LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL;
 
 	LLUUID source_id;
 	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id);
@@ -2117,7 +2117,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
 	}
 	else
 	{
-		llwarns << "Calling card offer from an unknown source." << llendl;
+		LL_WARNS("Messaging") << "Calling card offer from an unknown source." << LL_ENDL;
 	}
 
 	delete offerdata; // !=NULL if we didn't give ownership away
@@ -2310,10 +2310,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
 				break;
 			case CHAT_TYPE_START:
 			case CHAT_TYPE_STOP:
-				llwarns << "Got chat type start/stop in main chat processing." << llendl;
+				LL_WARNS("Messaging") << "Got chat type start/stop in main chat processing." << LL_ENDL;
 				break;
 			default:
-				llwarns << "Unknown type " << chat.mChatType << " in chat!" << llendl;
+				LL_WARNS("Messaging") << "Unknown type " << chat.mChatType << " in chat!" << LL_ENDL;
 				verb = " say, ";
 				break;
 			}
@@ -2406,7 +2406,7 @@ void process_teleport_progress(LLMessageSystem* msg, void**)
 	if((gAgent.getID() != agent_id)
 	   || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))
 	{
-		llwarns << "Unexpected teleport progress message." << llendl;
+		LL_WARNS("Messaging") << "Unexpected teleport progress message." << LL_ENDL;
 		return;
 	}
 	U32 teleport_flags = 0x0;
@@ -2421,7 +2421,7 @@ void process_teleport_progress(LLMessageSystem* msg, void**)
 	}
 	char buffer[MAX_STRING];		/* Flawfinder: ignore */
 	msg->getString("Info", "Message", MAX_STRING, buffer);
-	lldebugs << "teleport progress: " << buffer << llendl;
+	LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL;
 
 	//Sorta hacky...default to using simulator raw messages
 	//if we don't find the coresponding mapping in our progress mappings
@@ -2545,12 +2545,12 @@ BOOL LLPostTeleportNotifiers::tick()
 // We're going to pretend to be a new agent
 void process_teleport_finish(LLMessageSystem* msg, void**)
 {
-	//llinfos << "Got teleport location message" << llendl;
+	LL_DEBUGS("Messaging") << "Got teleport location message" << LL_ENDL;
 	LLUUID agent_id;
 	msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
 	if (agent_id != gAgent.getID())
 	{
-		llwarns << "Got teleport notification for wrong agent!" << llendl;
+		LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL;
 		return;
 	}
 
@@ -2618,8 +2618,8 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
 */
 
 	// now, use the circuit info to tell simulator about us!
-	llinfos << "process_teleport_finish() Enabling "
-			<< sim_host << " with code " << msg->mOurCircuitCode << llendl;
+	LL_INFOS("Messaging") << "process_teleport_finish() Enabling "
+			<< sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
 	msg->newMessageFast(_PREHASH_UseCircuitCode);
 	msg->nextBlockFast(_PREHASH_CircuitCode);
 	msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
@@ -2680,12 +2680,12 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
 	if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
 	{
-		llwarns << "Incorrect id in process_agent_movement_complete()"
-				<< llendl;
+		LL_WARNS("Messaging") << "Incorrect id in process_agent_movement_complete()"
+				<< LL_ENDL;
 		return;
 	}
 
-	llinfos << "process_agent_movement_complete()" << llendl;
+	LL_DEBUGS("Messaging") << "process_agent_movement_complete()" << LL_ENDL;
 
 	// *TODO: check timestamp to make sure the movement compleation
 	// makes sense.
@@ -2704,7 +2704,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	{
 		// Could happen if you were immediately god-teleported away on login,
 		// maybe other cases.  Continue, but warn.  JC
-		llwarns << "agent_movement_complete() with NULL avatarp." << llendl;
+		LL_WARNS("Messaging") << "agent_movement_complete() with NULL avatarp." << LL_ENDL;
 	}
 
 	F32 x, y;
@@ -2714,19 +2714,19 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	{
 		if (gAgent.getRegion())
 		{
-			llwarns << "current region " << gAgent.getRegion()->getOriginGlobal() << llendl;
+			LL_WARNS("Messaging") << "current region " << gAgent.getRegion()->getOriginGlobal() << LL_ENDL;
 		}
 
-		llwarns << "Agent being sent to invalid home region: " 
+		LL_WARNS("Messaging") << "Agent being sent to invalid home region: " 
 			<< x << ":" << y 
 			<< " current pos " << gAgent.getPositionGlobal()
-			<< llendl;
+			<< LL_ENDL;
 		LLAppViewer::instance()->forceDisconnect("You were sent to an invalid region.");
 		return;
 
 	}
 
-	llinfos << "Changing home region to " << x << ":" << y << llendl;
+	LL_INFOS("Messaging") << "Changing home region to " << x << ":" << y << LL_ENDL;
 
 	// set our upstream host the new simulator and shuffle things as
 	// appropriate.
@@ -2846,11 +2846,11 @@ void process_crossed_region(LLMessageSystem* msg, void**)
 	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
 	if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
 	{
-		llwarns << "Incorrect id in process_crossed_region()"
-				<< llendl;
+		LL_WARNS("Messaging") << "Incorrect id in process_crossed_region()"
+				<< LL_ENDL;
 		return;
 	}
-	llinfos << "process_crossed_region()" << llendl;
+	LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL;
 
 	U32 sim_ip;
 	msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip);
@@ -2978,24 +2978,24 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
 /*
 		if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT)
 		{
-			//llinfos << "head rot " << head_rotation << llendl;
-			llinfos << "head_rot_chg = " << head_rot_chg << llendl;
+			//LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL;
+			LL_INFOS("Messaging") << "head_rot_chg = " << head_rot_chg << LL_ENDL;
 		}
 		if (cam_rot_chg.magVec() > ROTATION_THRESHOLD) 
 		{
-			llinfos << "cam rot " <<  cam_rot_chg.magVec() << llendl;
+			LL_INFOS("Messaging") << "cam rot " <<  cam_rot_chg.magVec() << LL_ENDL;
 		}
 		if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD)
 		{
-			llinfos << "cam center " << cam_center_chg.magVec() << llendl;
+			LL_INFOS("Messaging") << "cam center " << cam_center_chg.magVec() << LL_ENDL;
 		}
 //		if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD)
 //		{
-//			llinfos << "drag delta " << drag_delta_chg.magVec() << llendl;
+//			LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL;
 //		}
 		if (control_flag_change)
 		{
-			llinfos << "dcf = " << control_flag_change << llendl;
+			LL_INFOS("Messaging") << "dcf = " << control_flag_change << LL_ENDL;
 		}
 */
 
@@ -3044,7 +3044,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
 
 //		if (camera_pos_agent.mV[VY] > 255.f)
 //		{
-//			llinfos << "Sending camera center " << camera_pos_agent << llendl;
+//			LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL;
 //		}
 		
 		msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
@@ -3059,12 +3059,12 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
 		{
 			if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
 			{
-				llinfos << "AgentUpdate left button down" << llendl;
+				LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
 			}
 
 			if (control_flags & AGENT_CONTROL_LBUTTON_UP)
 			{
-				llinfos << "AgentUpdate left button up" << llendl;
+				LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
 			}
 		}
 
@@ -3079,7 +3079,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
 			gAgent.sendReliableMessage();
 		}
 
-		//llinfos << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << llendl;
+//		LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL;
 
 		// Copy the old data 
 		last_head_rot = head_rotation;
@@ -3192,13 +3192,13 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
 											gMessageSystem->getSenderPort());
 		if (id == LLUUID::null)
 		{
-			//llinfos << "Unknown kill for local " << local_id << llendl;
+			LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL;
 			gObjectList.mNumUnknownKills++;
 			continue;
 		}
 		else
 		{
-			//llinfos << "Kill message for local " << local_id << llendl;
+			LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL;
 		}
 
 		LLSelectMgr::getInstance()->removeObjectFromSelections(id);
@@ -3228,7 +3228,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
 			}
 			else
 			{
-				llwarns << "Object in UUID lookup, but not on object list in kill!" << llendl;
+				LL_WARNS("Messaging") << "Object in UUID lookup, but not on object list in kill!" << LL_ENDL;
 				gObjectList.mNumUnknownKills++;
 			}
 		}
@@ -3257,8 +3257,8 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
 
 	LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec);
 
-	//lldebugs << "time_synch() - " << sun_direction << ", " << sun_ang_velocity
-	//		 << ", " << phase << llendl;
+	//LL_DEBUGS("Messaging") << "time_synch() - " << sun_direction << ", " << sun_ang_velocity
+	//		 << ", " << phase << LL_ENDL;
 
 	gSky.setSunPhase(phase);
 	gSky.setSunTargetDirection(sun_direction, sun_ang_velocity);
@@ -3510,7 +3510,8 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
 			LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value);
 			break;
 		default:
-// 			llwarns << "Unknown stat id" << stat_id << llendl;
+			// Used to be a commented out warning.
+ 			LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL;
 		  break;
 		}
 	}
@@ -3577,7 +3578,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 	if (!avatarp)
 	{
 		// no agent by this ID...error?
-		llwarns << "Received animation state for unknown avatar" << uuid << llendl;
+		LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL;
 		return;
 	}
 
@@ -3595,7 +3596,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 			mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
 			mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
 
-			//llinfos << "Anim sequence ID: " << anim_sequence_id << llendl;
+			LL_DEBUGS("Messaging") << "Anim sequence ID: " << anim_sequence_id << LL_ENDL;
 
 			avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
 
@@ -3655,7 +3656,7 @@ void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data)
 	}
 	else
 	{
-		llwarns << "avatar_appearance sent for unknown avatar " << uuid << llendl;
+		LL_WARNS("Messaging") << "avatar_appearance sent for unknown avatar " << uuid << LL_ENDL;
 	}
 }
 
@@ -3721,7 +3722,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	}
 	else
 	{
-		llwarns << "Received sit approval for unknown object " << sitObjectID << llendl;
+		LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL;
 	}
 }
 
@@ -3871,13 +3872,13 @@ void process_name_value(LLMessageSystem *mesgsys, void **user_data)
 		for (i = 0; i < num_blocks; i++)
 		{
 			mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i);
-			llinfos << "Added to object Name Value: " << temp_str << llendl;
+			LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL;
 			object->addNVPair(temp_str);
 		}
 	}
 	else
 	{
-		llinfos << "Can't find object " << id << " to add name value pair" << llendl;
+		LL_INFOS("Messaging") << "Can't find object " << id << " to add name value pair" << LL_ENDL;
 	}
 }
 
@@ -3897,13 +3898,13 @@ void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data)
 		for (i = 0; i < num_blocks; i++)
 		{
 			mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i);
-			llinfos << "Removed from object Name Value: " << temp_str << llendl;
+			LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL;
 			object->removeNVPair(temp_str);
 		}
 	}
 	else
 	{
-		llinfos << "Can't find object " << id << " to remove name value pair" << llendl;
+		LL_INFOS("Messaging") << "Can't find object " << id << " to remove name value pair" << LL_ENDL;
 	}
 }
 
@@ -3983,8 +3984,8 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
 	msg->getS32("MoneyData", "SquareMetersCredit", credit);
 	msg->getS32("MoneyData", "SquareMetersCommitted", committed);
 	msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description,	STD_STRING_BUF_SIZE,	desc);
-	llinfos << "L$, credit, committed: " << balance << " " << credit << " "
-			<< committed << llendl;
+	LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " "
+			<< committed << LL_ENDL;
 
 	if (gStatusBar)
 	{
@@ -4028,10 +4029,10 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
 		const S32 POP_FRONT_SIZE = 12;
 		if(recent.size() > MAX_LOOKBACK)
 		{
-			lldebugs << "Removing oldest transaction records" << llendl;
+			LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL;
 			recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE);
 		}
-		//lldebugs << "Pushing back transaction " << tid << llendl;
+		//LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL;
 		recent.push_back(tid);
 	}
 }
@@ -4476,9 +4477,9 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
 	switch (question_throttle.noteAction(throttle_owner_name))
 	{
 		case LLStringThrottle::THROTTLE_NEWLY_BLOCKED:
-			llinfos << "process_script_question throttled"
+			LL_INFOS("Messaging") << "process_script_question throttled"
 					<< " owner_name:" << owner_name
-					<< llendl;
+					<< LL_ENDL;
 			// Fall through
 
 		case LLStringThrottle::THROTTLE_BLOCKED:
@@ -4540,7 +4541,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
 
 void process_derez_container(LLMessageSystem *msg, void**)
 {
-	llwarns << "call to deprecated process_derez_container" << llendl;
+	LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL;
 }
 
 void container_inventory_arrived(LLViewerObject* object,
@@ -4548,7 +4549,7 @@ void container_inventory_arrived(LLViewerObject* object,
 								 S32 serial_num,
 								 void* data)
 {
-	llinfos << "container_inventory_arrived()" << llendl;
+	LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL;
 	if( gAgent.cameraMouselook() )
 	{
 		gAgent.changeCameraToDefault();
@@ -4694,7 +4695,7 @@ void process_teleport_local(LLMessageSystem *msg,void**)
 	msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
 	if (agent_id != gAgent.getID())
 	{
-		llwarns << "Got teleport notification for wrong agent!" << llendl;
+		LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL;
 		return;
 	}
 
@@ -4924,8 +4925,8 @@ void process_user_info_reply(LLMessageSystem* msg, void**)
 	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
 	if(agent_id != gAgent.getID())
 	{
-		llwarns << "process_user_info_reply - "
-				<< "wrong agent id." << llendl;
+		LL_WARNS("Messaging") << "process_user_info_reply - "
+				<< "wrong agent id." << LL_ENDL;
 	}
 	
 	BOOL im_via_email;
@@ -5133,7 +5134,7 @@ void process_load_url(LLMessageSystem* msg, void**)
 	if (LLMuteList::getInstance()->isMuted(infop->mObjectID, infop->mObjectName) ||
 	    LLMuteList::getInstance()->isMuted(infop->mOwnerID))
 	{
-		llinfos<<"Ignoring load_url from muted object/owner."<<llendl;
+		LL_INFOS("Messaging")<<"Ignoring load_url from muted object/owner."<<LL_ENDL;
 		delete infop;
 		infop = NULL;
 		return;
@@ -5162,7 +5163,7 @@ void process_initiate_download(LLMessageSystem* msg, void**)
 	msg->getUUID("AgentData", "AgentID", agent_id);
 	if (agent_id != gAgent.getID())
 	{
-		llwarns << "Initiate download for wrong agent" << llendl;
+		LL_WARNS("Messaging") << "Initiate download for wrong agent" << LL_ENDL;
 		return;
 	}
 
@@ -5288,7 +5289,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 					LLAssetType::EType type,
 					void* user_data, S32 status, LLExtStat ext_status)
 {
-	llinfos << "onCovenantLoadComplete()" << llendl;
+	LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL;
 	std::string covenant_text;
 	if(0 == status)
 	{
@@ -5299,7 +5300,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 		char* buffer = new char[file_length+1];
 		if (buffer == NULL)
 		{
-			llerrs << "Memory Allocation failed" << llendl;
+			LL_ERRS("Messaging") << "Memory Allocation failed" << LL_ENDL;
 			return;
 		}
 
@@ -5316,7 +5317,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 						       file_length+1);
 			if( !editor->importBuffer( buffer ) )
 			{
-				llwarns << "Problem importing estate covenant." << llendl;
+				LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
 				covenant_text = "Problem importing estate covenant.";
 			}
 			else
@@ -5329,7 +5330,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 		}
 		else
 		{
-			llwarns << "Problem importing estate covenant: Covenant file format error." << llendl;
+			LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL;
 			covenant_text = "Problem importing estate covenant: Covenant file format error.";
 		}
 	}
@@ -5351,7 +5352,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 			covenant_text = "Unable to load estate covenant at this time.";
 		}
 		
-		llwarns << "Problem loading notecard: " << status << llendl;
+		LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL;
 	}
 	LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
 	LLPanelLandCovenant::updateCovenantText(covenant_text);
@@ -5369,7 +5370,7 @@ void process_feature_disabled_message(LLMessageSystem* msg, void**)
 	msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID);
 	msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID);
 	
-	llwarns << "Blacklisted Feature Response:" << &messageText[0] << llendl;
+	LL_WARNS("Messaging") << "Blacklisted Feature Response:" << &messageText[0] << LL_ENDL;
 }
 
 // ------------------------------------------------------------
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 5d7bac7ab37..d3b7a77297f 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1307,6 +1307,7 @@ void LLViewerRegion::unpackRegionHandshake()
 
 class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 {
+	LOG_CLASS(BaseCapabilitiesComplete);
 public:
     BaseCapabilitiesComplete(LLViewerRegion* region)
 		: mRegion(region)
@@ -1314,8 +1315,7 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 
     void error(U32 statusNum, const std::string& reason)
     {
-		llinfos << "BaseCapabilitiesComplete::error "
-			<< statusNum << ": " << reason << llendl;
+		LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL;
 		
 		if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
 		{
@@ -1329,8 +1329,8 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 		for(iter = content.beginMap(); iter != content.endMap(); ++iter)
 		{
 			mRegion->setCapability(iter->first, iter->second);
-			llinfos << "BaseCapabilitiesComplete::result got capability for " 
-				<< iter->first << llendl;
+			LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " 
+				<< iter->first << LL_ENDL;
 
 			/* HACK we're waiting for the ServerReleaseNotes */
 			if ((iter->first == "ServerReleaseNotes") && (LLFloaterReleaseMsg::sDisplayMessage))
diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp
index 9a9fcdd9acb..c23a74c5334 100644
--- a/indra/newview/llviewerthrottle.cpp
+++ b/indra/newview/llviewerthrottle.cpp
@@ -182,9 +182,9 @@ void LLViewerThrottleGroup::dump()
 	S32 i;
 	for (i = 0; i < TC_EOF; i++)
 	{
-		llinfos << LLViewerThrottle::sNames[i] << ": " << mThrottles[i] << llendl;
+		LL_DEBUGS("Throttle") << LLViewerThrottle::sNames[i] << ": " << mThrottles[i] << LL_ENDL;
 	}
-	llinfos << "Total: " << mThrottleTotal << llendl;
+	LL_DEBUGS("Throttle") << "Total: " << mThrottleTotal << LL_ENDL;
 }
 
 class LLBPSListener : public LLSimpleListener
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 0e39c9d5d49..5d3487517b3 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1529,9 +1529,9 @@ LLViewerWindow::LLViewerWindow(
 		ignore_pixel_depth,
 		gSavedSettings.getU32("RenderFSAASamples"));
 #if LL_WINDOWS
-	if (!LLWinDebug::setupExceptionHandler())
+	if (!LLWinDebug::checkExceptionHandler())
 	{
-		llwarns << " Someone took over my exception handler (post createWindow)!" << llendl;
+		LL_WARNS("Window") << " Someone took over my exception handler (post createWindow)!" << LL_ENDL;
 	}
 #endif
 
@@ -1542,8 +1542,8 @@ LLViewerWindow::LLViewerWindow(
 		llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly.  See README-linux.txt or README-solaris.txt for further information."
 				<< llendl;
 #else
-		llwarns << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
-				<< llendl;
+		LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
+				<< LL_ENDL;
 #endif
         LLAppViewer::instance()->forceExit(1);
 	}
@@ -1569,7 +1569,7 @@ LLViewerWindow::LLViewerWindow(
 	// We want to set this stuff up BEFORE we initialize the pipeline, so we can turn off
 	// stuff like AGP if we think that it'll crash the viewer.
 	//
-	llinfos << "Loading feature tables." << llendl;
+	LL_DEBUGS("Window") << "Loading feature tables." << LL_ENDL;
 
 	LLFeatureManager::getInstance()->init();
 
@@ -4939,7 +4939,7 @@ void LLViewerWindow::restoreGL(const LLString& progress_message)
 		}
 		llinfos << "...Restoring GL done" << llendl;
 #if LL_WINDOWS
-		if (SetUnhandledExceptionFilter(LLWinDebug::handleException) != LLWinDebug::handleException)
+		if(!LLWinDebug::checkExceptionHandler())
 		{
 			llwarns << " Someone took over my exception handler (post restoreGL)!" << llendl;
 		}
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index bba9fe1ccfc..96f69e94722 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -268,7 +268,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
 			}
 			else
 			{
-				llinfos << "parsing: " << mInput.substr(start, delim - start) << llendl;
+				LL_INFOS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
 			}
 		}
 		
@@ -287,12 +287,12 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
 	if(start != 0)
 		mInput = mInput.substr(start);
 
-//	llinfos << "at end, mInput is: " << mInput << llendl;
+	LL_DEBUGS("Voice") << "at end, mInput is: " << mInput << LL_ENDL;
 	
 	if(!gVoiceClient->mConnected)
 	{
 		// If voice has been disabled, we just want to close the socket.  This does so.
-		llinfos << "returning STATUS_STOP" << llendl;
+		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
 		return STATUS_STOP;
 	}
 	
@@ -366,17 +366,17 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
 				}
 			}
 		}
-		//llinfos << tag << " (" << responseDepth << ")"  << llendl;
+		LL_DEBUGS("Voice") << tag << " (" << responseDepth << ")"  << LL_ENDL;
 	}
 	else
 	{
 		if (ignoringTags)
 		{
-			//llinfos << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << llendl;
+			LL_DEBUGS("Voice") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
 		}
 		else
 		{
-			//llinfos << tag << " (" << responseDepth << ")"  << llendl;
+			LL_DEBUGS("Voice") << tag << " (" << responseDepth << ")"  << LL_ENDL;
 	
 			// Ignore the InputXml stuff so we don't get confused
 			if (strcmp("InputXml", tag) == 0)
@@ -385,7 +385,7 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
 				ignoreDepth = responseDepth;
 				accumulateText = false;
 
-				//llinfos << "starting ignore, ignoreDepth is " << ignoreDepth << llendl;
+				LL_DEBUGS("Voice") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
 			}
 			else if (strcmp("CaptureDevices", tag) == 0)
 			{
@@ -413,18 +413,18 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
 	{
 		if (ignoreDepth == responseDepth)
 		{
-			//llinfos << "end of ignore" << llendl;
+			LL_DEBUGS("Voice") << "end of ignore" << LL_ENDL;
 			ignoringTags = false;
 		}
 		else
 		{
-			//llinfos << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << llendl;
+			LL_DEBUGS("Voice") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
 		}
 	}
 	
 	if (!ignoringTags)
 	{
-		//llinfos << "processing tag " << tag << " (depth = " << responseDepth << ")" << llendl;
+		LL_DEBUGS("Voice") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
 
 		// Closing a tag. Finalize the text we've accumulated and reset
 		if (strcmp("ReturnCode", tag) == 0)
@@ -531,7 +531,7 @@ void LLVivoxProtocolParser::CharData(const char *buffer, int length)
 
 void LLVivoxProtocolParser::processResponse(std::string tag)
 {
-	//llinfos << tag << llendl;
+	LL_DEBUGS("Voice") << tag << LL_ENDL;
 
 	if (isEvent)
 	{
@@ -700,9 +700,9 @@ class LLVoiceClientCapResponder : public LLHTTPClient::Responder
 
 void LLVoiceClientCapResponder::error(U32 status, const std::string& reason)
 {
-	llwarns << "LLVoiceClientCapResponder::error("
+	LL_WARNS("Voice") << "LLVoiceClientCapResponder::error("
 		<< status << ": " << reason << ")"
-		<< llendl;
+		<< LL_ENDL;
 }
 
 void LLVoiceClientCapResponder::result(const LLSD& content)
@@ -710,8 +710,8 @@ void LLVoiceClientCapResponder::result(const LLSD& content)
 	LLSD::map_const_iterator iter;
 	for(iter = content.beginMap(); iter != content.endMap(); ++iter)
 	{
-		llinfos << "LLVoiceClientCapResponder::result got " 
-			<< iter->first << llendl;
+		LL_DEBUGS("Voice") << "LLVoiceClientCapResponder::result got " 
+			<< iter->first << LL_ENDL;
 	}
 
 	if ( content.has("voice_credentials") )
@@ -918,7 +918,7 @@ bool LLVoiceClient::writeString(const std::string &str)
 		apr_size_t size = (apr_size_t)str.size();
 		apr_size_t written = size;
 	
-//		llinfos << "sending: " << str << llendl;
+		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
 
 		// MBW -- XXX -- check return code - sockets will fail (broken, etc.)
 		err = apr_socket_send(
@@ -941,7 +941,7 @@ bool LLVoiceClient::writeString(const std::string &str)
 		{
 			// Assume any socket error means something bad.  For now, just close the socket.
 			char buf[MAX_STRING];
-			llwarns << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << llendl;
+			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
 			daemonDied();
 		}
 	}
@@ -965,7 +965,7 @@ void LLVoiceClient::connectorCreate()
 	
 	if(savedLogLevel != "-1")
 	{
-		llinfos << "creating connector with logging enabled" << llendl;
+		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
 		loglevel = "10";
 		logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
 	}
@@ -1014,7 +1014,7 @@ void LLVoiceClient::userAuthorized(const std::string& firstName, const std::stri
 	mAccountDisplayName += " ";
 	mAccountDisplayName += lastName;
 
-	llinfos << "name \"" << mAccountDisplayName << "\" , ID " << agentID << llendl;
+	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
 
 	std::string gridname = gGridName;
 	LLString::toLower(gridname);
@@ -1065,13 +1065,13 @@ void LLVoiceClient::login(
 	if((getState() >= stateLoggingIn) && (getState() < stateLoggedOut))
 	{
 		// Already logged in.  This is an internal error.
-		llerrs << "called from wrong state." << llendl;
+		LL_ERRS("Voice") << "Can't login again. Called from wrong state." << LL_ENDL;
 	}
 	else if ( accountName != mAccountName )
 	{
 		//TODO: error?
-		llinfos << "Wrong account name! " << accountName
-				<< " instead of " << mAccountName << llendl;
+		LL_WARNS("Voice") << "Wrong account name! " << accountName
+				<< " instead of " << mAccountName << LL_ENDL;
 	}
 	else
 	{
@@ -1167,7 +1167,7 @@ const char *LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv
 
 void LLVoiceClient::setState(state inState)
 {
-	llinfos << "entering state " << state2string(inState) << llendl;
+	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
 	
 	mState = inState;
 }
@@ -1188,7 +1188,7 @@ void LLVoiceClient::stateMachine()
 			if(!mConnected)
 			{
 				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
-				llinfos << "Disabling voice before connection to daemon, terminating." << llendl;
+				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
 				killGateway();
 			}
 			
@@ -1213,7 +1213,7 @@ void LLVoiceClient::stateMachine()
 			std::string regionName = region->getName();
 			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
 		
-//			llinfos << "Region name = \"" << regionName <<"\", " << "parcel local ID = " << parcelLocalID << llendl;
+			LL_DEBUGS("Voice") << "Region name = \"" << regionName <<"\", " << "parcel local ID = " << parcelLocalID << LL_ENDL;
 
 			// The region name starts out empty and gets filled in later.  
 			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
@@ -1277,7 +1277,7 @@ void LLVoiceClient::stateMachine()
 						args += " -ll ";
 						args += loglevel;
 						
-//						llinfos << "Args for SLVoice: " << args << llendl;
+						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
 
 #if LL_WINDOWS
 						PROCESS_INFORMATION pinfo;
@@ -1349,7 +1349,7 @@ void LLVoiceClient::stateMachine()
 					}	
 					else
 					{
-						llinfos << exe_path << "not found." << llendl
+						LL_INFOS("Voice") << exe_path << "not found." << LL_ENDL
 					}	
 				}
 				else
@@ -1376,7 +1376,7 @@ void LLVoiceClient::stateMachine()
 		break;
 		
 		case stateDaemonLaunched:
-//			llinfos << "Connecting to vivox daemon" << llendl;
+			LL_DEBUGS("Voice") << "Connecting to vivox daemon" << LL_ENDL;
 			if(mUpdateTimer.hasExpired())
 			{
 				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
@@ -1533,7 +1533,7 @@ void LLVoiceClient::stateMachine()
 					
 					if(mTuningMicVolumeDirty)
 					{
-						llinfos << "setting tuning mic level to " << mTuningMicVolume << llendl;
+						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
 						stream
 						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
 						<< "<Level>" << mTuningMicVolume << "</Level>"
@@ -1584,12 +1584,12 @@ void LLVoiceClient::stateMachine()
 			
 			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
 			{
-				llinfos << "too many login retries, giving up." << llendl;
+				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
 				setState(stateLoginFailed);
 			}
 			else
 			{
-				llinfos << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << llendl;
+				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
 				mUpdateTimer.start();
 				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
 				setState(stateLoginRetryWait);
@@ -1849,7 +1849,7 @@ void LLVoiceClient::stateMachine()
 
 		case stateJoinSessionFailed:
 			// Transition to error state.  Send out any notifications here.
-			llwarns << "stateJoinSessionFailed: (" << mVivoxErrorStatusCode << "): " << mVivoxErrorStatusString << llendl;
+			LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mVivoxErrorStatusCode << "): " << mVivoxErrorStatusString << LL_ENDL;
 			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
 			setState(stateJoinSessionFailedWaiting);
 		break;
@@ -1869,8 +1869,7 @@ void LLVoiceClient::stateMachine()
 
 	        case stateMicTuningNoLogin:
 			// *TODO: Implement me.
-			llwarns << "stateMicTuningNoLogin not handled"
-				<< llendl;
+			LL_WARNS("Voice") << "stateMicTuningNoLogin not handled" << LL_ENDL;
 		break;
 	}
 
@@ -1939,7 +1938,7 @@ void LLVoiceClient::channelGetListSendMessage()
 
 void LLVoiceClient::sessionCreateSendMessage()
 {
-	llinfos << "requesting join: " << mNextSessionURI << llendl;
+	LL_DEBUGS("Voice") << "requesting join: " << mNextSessionURI << LL_ENDL;
 
 	mSessionURI = mNextSessionURI;
 	mNonSpatialChannel = !mNextSessionSpatial;
@@ -1979,7 +1978,7 @@ void LLVoiceClient::sessionCreateSendMessage()
 
 void LLVoiceClient::sessionConnectSendMessage()
 {
-	llinfos << "connecting to session handle: " << mNextSessionHandle << llendl;
+	LL_DEBUGS("Voice") << "connecting to session handle: " << mNextSessionHandle << LL_ENDL;
 	
 	mSessionHandle = mNextSessionHandle;
 	mSessionURI = mNextP2PSessionURI;
@@ -2008,7 +2007,7 @@ void LLVoiceClient::sessionTerminate()
 
 void LLVoiceClient::sessionTerminateSendMessage()
 {
-	llinfos << "leaving session: " << mSessionURI << llendl;
+	LL_DEBUGS("Voice") << "leaving session: " << mSessionURI << LL_ENDL;
 
 	switch(getState())
 	{
@@ -2027,7 +2026,7 @@ void LLVoiceClient::sessionTerminateSendMessage()
 			}
 			else
 			{
-				llwarns << "called with no session handle" << llendl;	
+				LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
 				setState(stateSessionTerminated);
 			}
 		break;
@@ -2037,14 +2036,14 @@ void LLVoiceClient::sessionTerminateSendMessage()
 		break;
 		
 		default:
-			llwarns << "called from unknown state" << llendl;
+			LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
 		break;
 	}
 }
 
 void LLVoiceClient::sessionTerminateByHandle(std::string &sessionHandle)
 {
-	llinfos << "Sending Session.Terminate with handle " << sessionHandle << llendl;	
+	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << sessionHandle << LL_ENDL;	
 
 	std::ostringstream stream;
 	stream
@@ -2079,14 +2078,14 @@ void LLVoiceClient::getRenderDevicesSendMessage()
 void LLVoiceClient::clearCaptureDevices()
 {
 	// MBW -- XXX -- do something here
-	llinfos << "called" << llendl;
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
 	mCaptureDevices.clear();
 }
 
 void LLVoiceClient::addCaptureDevice(const std::string& name)
 {
 	// MBW -- XXX -- do something here
-	llinfos << name << llendl;
+	LL_DEBUGS("Voice") << name << LL_ENDL;
 
 	mCaptureDevices.push_back(name);
 }
@@ -2119,14 +2118,14 @@ void LLVoiceClient::setCaptureDevice(const std::string& name)
 void LLVoiceClient::clearRenderDevices()
 {
 	// MBW -- XXX -- do something here
-	llinfos << "called" << llendl;
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
 	mRenderDevices.clear();
 }
 
 void LLVoiceClient::addRenderDevice(const std::string& name)
 {
 	// MBW -- XXX -- do something here
-	llinfos << name << llendl;
+	LL_DEBUGS("Voice") << name << LL_ENDL;
 	mRenderDevices.push_back(name);
 }
 
@@ -2210,7 +2209,7 @@ void LLVoiceClient::tuningRenderStopSendMessage()
 
 void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
 {
-	llinfos << "sending CaptureAudioStart" << llendl;
+	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
 	
 	std::ostringstream stream;
 	stream
@@ -2223,7 +2222,7 @@ void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
 
 void LLVoiceClient::tuningCaptureStopSendMessage()
 {
-	llinfos << "sending CaptureAudioStop" << llendl;
+	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
 	
 	std::ostringstream stream;
 	stream
@@ -2296,7 +2295,7 @@ void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
 void LLVoiceClient::daemonDied()
 {
 	// The daemon died, so the connection is gone.  Reset everything and start over.
-	llwarns << "Connection to vivox daemon lost.  Resetting state."<< llendl;
+	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
 
 	closeSocket();
 	removeAllParticipants();
@@ -2332,7 +2331,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 		u = mAvatarRot.getUpRow();
 		a = mAvatarRot.getFwdRow();
 			
-//		llinfos << "Sending speaker position " << mSpeakerPosition << llendl;
+		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
 
 		stream 
 			<< "<Position>"
@@ -2395,7 +2394,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 		u = earRot.getUpRow();
 		a = earRot.getFwdRow();
 
-//		llinfos << "Sending listener position " << mListenerPosition << llendl;
+		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
 
 		stream 
 			<< "<Position>"
@@ -2435,7 +2434,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 		// NOTE that the state of "PTT" is the inverse of "local mute".
 		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
 		
-//		llinfos << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << llendl;
+		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
 
 		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
 			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
@@ -2456,7 +2455,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 			{
 				int volume = p->mOnMuteList?0:p->mUserVolume;
 				
-				llinfos << "Setting volume for avatar " << p->mAvatarID << " to " << volume << llendl;
+				LL_INFOS("Voice") << "Setting volume for avatar " << p->mAvatarID << " to " << volume << LL_ENDL;
 				
 				// Send a mute/unumte command for the user (actually "volume for me").
 				stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
@@ -2473,7 +2472,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 	if(mSpeakerMuteDirty)
 	{
 		const char *muteval = ((mSpeakerVolume == -100)?"true":"false");
-		llinfos << "Setting speaker mute to " << muteval  << llendl;
+		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
 		
 		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
 			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
@@ -2483,7 +2482,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 	
 	if(mSpeakerVolumeDirty)
 	{
-		llinfos << "Setting speaker volume to " << mSpeakerVolume  << llendl;
+		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
 
 		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
 			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
@@ -2493,7 +2492,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 	
 	if(mMicVolumeDirty)
 	{
-		llinfos << "Setting mic volume to " << mMicVolume  << llendl;
+		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
 
 		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
 			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
@@ -2530,7 +2529,7 @@ void LLVoiceClient::sendPositionalUpdate(void)
 
 void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
 {
-	llinfos << "Setting input device = \"" << mCaptureDevice << "\"" << llendl;
+	LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
 	
 	stream 
 	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
@@ -2541,7 +2540,7 @@ void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
 
 void LLVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
 {
-	llinfos << "Setting output device = \"" << mRenderDevice << "\"" << llendl;
+	LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
 
 	stream
 	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
@@ -2557,7 +2556,7 @@ void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusS
 {	
 	if(statusCode != 0)
 	{
-		llwarns << "Connector.Create response failure: " << statusString << llendl;
+		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
 		setState(stateConnectorFailed);
 	}
 	else
@@ -2573,19 +2572,19 @@ void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusS
 
 void LLVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle)
 { 
-	llinfos << "Account.Login response (" << statusCode << "): " << statusString << llendl;
+	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
 	
 	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
 	
 	if ( statusCode == 401 )
 	{
 		// Login failure which is probably caused by the delay after a user's password being updated.
-		llinfos << "Account.Login response failure (" << statusCode << "): " << statusString << llendl;
+		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
 		setState(stateLoginRetry);
 	}
 	else if(statusCode != 0)
 	{
-		llwarns << "Account.Login response failure (" << statusCode << "): " << statusString << llendl;
+		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
 		setState(stateLoginFailed);
 	}
 	else
@@ -2604,7 +2603,7 @@ void LLVoiceClient::channelGetListResponse(int statusCode, std::string &statusSt
 {
 	if(statusCode != 0)
 	{
-		llwarns << "Account.ChannelGetList response failure: " << statusString << llendl;
+		LL_WARNS("Voice") << "Account.ChannelGetList response failure: " << statusString << LL_ENDL;
 		switchChannel();
 	}
 	else
@@ -2614,12 +2613,12 @@ void LLVoiceClient::channelGetListResponse(int statusCode, std::string &statusSt
 		if(uri.empty())
 		{	
 			// Lookup failed, can't join a channel for this area.
-			llinfos << "failed to map channel name: " << mChannelName << llendl;
+			LL_INFOS("Voice") << "failed to map channel name: " << mChannelName << LL_ENDL;
 		}
 		else
 		{
 			// We have a sip URL for this area.
-			llinfos << "mapped channel " << mChannelName << " to URI "<< uri << llendl;
+			LL_INFOS("Voice") << "mapped channel " << mChannelName << " to URI "<< uri << LL_ENDL;
 		}
 		
 		// switchChannel with an empty uri string will do the right thing (leave channel and not rejoin)
@@ -2631,13 +2630,13 @@ void LLVoiceClient::sessionCreateResponse(int statusCode, std::string &statusStr
 {	
 	if(statusCode != 0)
 	{
-		llwarns << "Session.Create response failure (" << statusCode << "): " << statusString << llendl;
+		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
 //		if(statusCode == 1015)
 //		{
 //			if(getState() == stateJoiningSession)
 //			{
 //				// this happened during a real join.  Going to sessionTerminated should cause a retry in appropriate cases.
-//				llwarns << "session handle \"" << sessionHandle << "\", mSessionStateEventHandle \"" << mSessionStateEventHandle << "\""<< llendl;
+//				LL_WARNS("Voice") << "session handle \"" << sessionHandle << "\", mSessionStateEventHandle \"" << mSessionStateEventHandle << "\""<< LL_ENDL;
 //				if(!sessionHandle.empty())
 //				{
 //					// This session is bad.  Terminate it.
@@ -2659,7 +2658,7 @@ void LLVoiceClient::sessionCreateResponse(int statusCode, std::string &statusStr
 //			else
 //			{
 //				// We didn't think we were in the middle of a join.  Don't change state.
-//				llwarns << "Not in stateJoiningSession, ignoring" << llendl;
+//				LL_WARNS("Voice") << "Not in stateJoiningSession, ignoring" << LL_ENDL;
 //			}
 //		}
 //		else
@@ -2671,7 +2670,7 @@ void LLVoiceClient::sessionCreateResponse(int statusCode, std::string &statusStr
 	}
 	else
 	{
-		llinfos << "Session.Create response received (success), session handle is " << sessionHandle << llendl;
+		LL_DEBUGS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
 		if(getState() == stateJoiningSession)
 		{
 			// This is also grabbed in the SessionStateChangeEvent handler, but it might be useful to have it early...
@@ -2689,10 +2688,10 @@ void LLVoiceClient::sessionConnectResponse(int statusCode, std::string &statusSt
 {
 	if(statusCode != 0)
 	{
-		llwarns << "Session.Connect response failure (" << statusCode << "): " << statusString << llendl;
+		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
 //		if(statusCode == 1015)
 //		{
-//			llwarns << "terminating existing session" << llendl;
+//			LL_WARNS("Voice") << "terminating existing session" << LL_ENDL;
 //			sessionTerminate();
 //		}
 //		else
@@ -2704,7 +2703,7 @@ void LLVoiceClient::sessionConnectResponse(int statusCode, std::string &statusSt
 	}
 	else
 	{
-		llinfos << "Session.Connect response received (success)" << llendl;
+		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
 	}
 }
 
@@ -2712,7 +2711,7 @@ void LLVoiceClient::sessionTerminateResponse(int statusCode, std::string &status
 {	
 	if(statusCode != 0)
 	{
-		llwarns << "Session.Terminate response failure: (" << statusCode << "): " << statusString << llendl;
+		LL_WARNS("Voice") << "Session.Terminate response failure: (" << statusCode << "): " << statusString << LL_ENDL;
 		if(getState() == stateLeavingSession)
 		{
 			// This is probably "(404): Server reporting Failure. Not a member of this conference."
@@ -2727,7 +2726,7 @@ void LLVoiceClient::logoutResponse(int statusCode, std::string &statusString)
 {	
 	if(statusCode != 0)
 	{
-		llwarns << "Account.Logout response failure: " << statusString << llendl;
+		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
 		// MBW -- XXX -- Should this ever fail?  do we care if it does?
 	}
 	
@@ -2741,7 +2740,7 @@ void LLVoiceClient::connectorShutdownResponse(int statusCode, std::string &statu
 {
 	if(statusCode != 0)
 	{
-		llwarns << "Connector.InitiateShutdown response failure: " << statusString << llendl;
+		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
 		// MBW -- XXX -- Should this ever fail?  do we care if it does?
 	}
 	
@@ -2765,7 +2764,7 @@ void LLVoiceClient::sessionStateChangeEvent(
 	switch(state)
 	{
 		case 4:	// I see this when joining the session
-			llinfos << "joined session " << uriString << ", name " << nameString << " handle " << mNextSessionHandle << llendl;
+			LL_INFOS("Voice") << "joined session " << uriString << ", name " << nameString << " handle " << mNextSessionHandle << LL_ENDL;
 
 			// Session create succeeded, move forward.
 			mSessionStateEventHandle = sessionHandle;
@@ -2778,23 +2777,23 @@ void LLVoiceClient::sessionStateChangeEvent(
 					setState(stateSessionJoined);
 					//RN: the uriString being returned by vivox here is actually your account uri, not the channel
 					// you are attempting to join, so ignore it
-					//llinfos << "received URI " << uriString << "(previously " << mSessionURI << ")" << llendl;
+					//LL_DEBUGS("Voice") << "received URI " << uriString << "(previously " << mSessionURI << ")" << LL_ENDL;
 					//mSessionURI = uriString;
 				}
 			}
 			else if(sessionHandle == mNextSessionHandle)
 			{
-//				llinfos << "received URI " << uriString << ", name " << nameString << " for next session (handle " << mNextSessionHandle << ")" << llendl;
+//				LL_DEBUGS("Voice") << "received URI " << uriString << ", name " << nameString << " for next session (handle " << mNextSessionHandle << ")" << LL_ENDL;
 			}
 			else
 			{
-				llwarns << "joining unknown session handle " << sessionHandle << ", URI " << uriString << ", name " << nameString << llendl;
+				LL_WARNS("Voice") << "joining unknown session handle " << sessionHandle << ", URI " << uriString << ", name " << nameString << LL_ENDL;
 				// MBW -- XXX -- Should we send a Session.Terminate here?
 			}
 			
 		break;
 		case 5:	// I see this when leaving the session
-			llinfos << "left session " << uriString << ", name " << nameString << " handle " << mNextSessionHandle << llendl;
+			LL_INFOS("Voice") << "left session " << uriString << ", name " << nameString << " handle " << mNextSessionHandle << LL_ENDL;
 
 			// Set the session handle to the empty string.  If we get back to stateJoiningSession, we'll want to wait for the new session handle.
 			if(sessionHandle == mSessionHandle)
@@ -2822,17 +2821,17 @@ void LLVoiceClient::sessionStateChangeEvent(
 					case stateJoinSessionFailed:
 					case stateJoinSessionFailedWaiting:
 						// normal transition
-						llinfos << "left session " << sessionHandle << "in state " << state2string(getState()) << llendl;
+						LL_INFOS("Voice") << "left session " << sessionHandle << "in state " << state2string(getState()) << LL_ENDL;
 						setState(stateSessionTerminated);
 					break;
 					
 					case stateSessionTerminated:
 						// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
-						llwarns << "left session " << sessionHandle << "in state " << state2string(getState()) << llendl;
+						LL_WARNS("Voice") << "left session " << sessionHandle << "in state " << state2string(getState()) << LL_ENDL;
 					break;
 					
 					default:
-						llwarns << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << llendl;
+						LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
 						setState(stateSessionTerminated);
 					break;
 				}
@@ -2843,14 +2842,14 @@ void LLVoiceClient::sessionStateChangeEvent(
 			}
 			else
 			{
-				llinfos << "leaving unknown session handle " << sessionHandle << ", URI " << uriString << ", name " << nameString << llendl;
+				LL_INFOS("Voice") << "leaving unknown session handle " << sessionHandle << ", URI " << uriString << ", name " << nameString << LL_ENDL;
 			}
 
 			mSessionStateEventHandle.clear();
 			mSessionStateEventURI.clear();
 		break;
 		default:
-			llwarns << "unknown state: " << state << llendl;
+			LL_WARNS("Voice") << "unknown state: " << state << LL_ENDL;
 		break;
 	}
 }
@@ -2861,7 +2860,7 @@ void LLVoiceClient::loginStateChangeEvent(
 		std::string &statusString, 
 		int state)
 {
-	llinfos << "state is " << state << llendl;
+	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
 	/*
 		According to Mike S., status codes for this event are:
 		login_state_logged_out=0,
@@ -2882,7 +2881,8 @@ void LLVoiceClient::loginStateChangeEvent(
 		break;
 		
 		default:
-//			llwarns << "unknown state: " << state << llendl;
+			//Used to be a commented out warning
+			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
 		break;
 	}
 }
@@ -2894,13 +2894,13 @@ void LLVoiceClient::sessionNewEvent(
 		std::string &nameString, 
 		std::string &uriString)
 {
-//	llinfos << "state is " << state << llendl;
+	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
 	
 	switch(state)
 	{
 		case 0:
 			{
-				llinfos << "session handle = " << eventSessionHandle << ", name = " << nameString << ", uri = " << uriString << llendl;
+				LL_DEBUGS("Voice") << "session handle = " << eventSessionHandle << ", name = " << nameString << ", uri = " << uriString << LL_ENDL;
 
 				LLUUID caller_id;
 				if(IDFromName(nameString, caller_id))
@@ -2918,13 +2918,13 @@ void LLVoiceClient::sessionNewEvent(
 				}
 				else
 				{
-					llwarns << "Could not generate caller id from uri " << uriString << llendl;
+					LL_WARNS("Voice") << "Could not generate caller id from uri " << uriString << LL_ENDL;
 				}
 			}
 		break;
 		
 		default:
-			llwarns << "unknown state: " << state << llendl;
+			LL_WARNS("Voice") << "unknown state: " << state << LL_ENDL;
 		break;
 	}
 }
@@ -2939,7 +2939,7 @@ void LLVoiceClient::participantStateChangeEvent(
 		int participantType)
 {
 	participantState *participant = NULL;
-	llinfos << "state is " << state << llendl;
+	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
 
 	switch(state)
 	{
@@ -2948,8 +2948,8 @@ void LLVoiceClient::participantStateChangeEvent(
 			if(participant)
 			{
 				participant->mName = nameString;
-				llinfos << "added participant \"" << participant->mName 
-						<< "\" (" << participant->mAvatarID << ")"<< llendl;
+				LL_DEBUGS("Voice") << "added participant \"" << participant->mName 
+						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
 			}
 		break;
 		case 9:	// I see this when a participant leaves
@@ -2960,7 +2960,7 @@ void LLVoiceClient::participantStateChangeEvent(
 			}
 		break;
 		default:
-//			llwarns << "unknown state: " << state << llendl;
+			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
 		break;
 	}
 }
@@ -2990,13 +2990,13 @@ void LLVoiceClient::participantPropertiesEvent(
 	}
 	else
 	{
-		llwarns << "unknown participant: " << uriString << llendl;
+		LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
 	}
 }
 
 void LLVoiceClient::auxAudioPropertiesEvent(F32 energy)
 {
-//	llinfos << "got energy " << energy << llendl;
+	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
 	mTuningEnergy = energy;
 }
 
@@ -3054,7 +3054,7 @@ LLVoiceClient::participantState *LLVoiceClient::addParticipant(const std::string
 			}
 		}
 		
-		llinfos << "participant \"" << result->mURI << "\" added." << llendl;
+		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
 	}
 	
 	return result;
@@ -3080,7 +3080,7 @@ void LLVoiceClient::removeParticipant(LLVoiceClient::participantState *participa
 	{
 		participantMap::iterator iter = mParticipantMap.find(participant->mURI);
 				
-		llinfos << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << llendl;
+		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
 
 		mParticipantMap.erase(iter);
 		delete participant;
@@ -3090,7 +3090,7 @@ void LLVoiceClient::removeParticipant(LLVoiceClient::participantState *participa
 
 void LLVoiceClient::removeAllParticipants()
 {
-	llinfos << "called" << llendl;
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
 
 	while(!mParticipantMap.empty())
 	{
@@ -3173,7 +3173,7 @@ void LLVoiceClient::clearChannelMap(void)
 
 void LLVoiceClient::addChannelMapEntry(std::string &name, std::string &uri)
 {
-//	llinfos << "Adding channel name mapping: " << name << " -> " << uri << llendl;
+	LL_DEBUGS("Voice") << "Adding channel name mapping: " << name << " -> " << uri << LL_ENDL;
 	mChannelMap.insert(channelMap::value_type(name, uri));
 }
 
@@ -3196,7 +3196,7 @@ void LLVoiceClient::parcelChanged()
 	if(getState() >= stateLoggedIn)
 	{
 		// If the user is logged in, start a channel lookup.
-		llinfos << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << llendl;
+		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
 
 		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
 		LLSD data;
@@ -3208,7 +3208,7 @@ void LLVoiceClient::parcelChanged()
 	else
 	{
 		// The transition to stateLoggedIn needs to kick this off again.
-		llinfos << "not logged in yet, deferring" << llendl;
+		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
 	}
 }
 
@@ -3220,7 +3220,7 @@ void LLVoiceClient::switchChannel(
 {
 	bool needsSwitch = false;
 	
-	llinfos << "called in state " << state2string(getState()) << " with uri \"" << uri << "\"" << llendl;
+	LL_DEBUGS("Voice") << "called in state " << state2string(getState()) << " with uri \"" << uri << "\"" << LL_ENDL;
 	
 	switch(getState())
 	{
@@ -3259,12 +3259,12 @@ void LLVoiceClient::switchChannel(
 		if(uri.empty())
 		{
 			// Leave any channel we may be in
-			llinfos << "leaving channel" << llendl;
+			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
 			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
 		}
 		else
 		{
-			llinfos << "switching to channel " << uri << llendl;
+			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
 		}
 		
 		if(getState() <= stateNoChannel)
@@ -3313,12 +3313,12 @@ void LLVoiceClient::setSpatialChannel(
 	mSpatialSessionURI = uri;
 	mAreaVoiceDisabled = mSpatialSessionURI.empty();
 
-	llinfos << "got spatial channel uri: \"" << uri << "\"" << llendl;
+	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
 	
 	if(mNonSpatialChannel || !mNextSessionSpatial)
 	{
 		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
-		llinfos << "in non-spatial chat, not switching channels" << llendl;
+		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
 	}
 	else
 	{
@@ -3560,7 +3560,7 @@ void LLVoiceClient::leaveChannel(void)
 {
 	if(getState() == stateRunning)
 	{
-//		llinfos << "leaving channel for teleport/logout" << llendl;
+		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
 		mChannelName.clear();
 		sessionTerminate();
 	}
@@ -3669,7 +3669,7 @@ void LLVoiceClient::setEarLocation(S32 loc)
 {
 	if(mEarLocation != loc)
 	{
-		llinfos << "Setting mEarLocation to " << loc << llendl;
+		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
 		
 		mEarLocation = loc;
 		mSpatialCoordsDirty = true;
@@ -3678,7 +3678,7 @@ void LLVoiceClient::setEarLocation(S32 loc)
 
 void LLVoiceClient::setVoiceVolume(F32 volume)
 {
-//	llinfos << "volume is " << volume << llendl;
+	LL_DEBUGS("Voice") << "volume is " << volume << LL_ENDL;
 
 	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
 	// Map it as follows: 0.0 -> -100, 0.5 -> 24, 1.0 -> 50
@@ -3727,7 +3727,7 @@ void LLVoiceClient::setVivoxDebugServerName(std::string &serverName)
 
 void LLVoiceClient::keyDown(KEY key, MASK mask)
 {	
-//	llinfos << "key is " << LLKeyboard::stringFromKey(key) << llendl;
+	LL_DEBUGS("Voice") << "key is " << LLKeyboard::stringFromKey(key) << LL_ENDL;
 
 	if (gKeyboard->getKeyRepeated(key))
 	{
@@ -4021,7 +4021,7 @@ void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusTy
 		mVivoxErrorStatusCode = 0;
 	}
 	
-	llinfos << " " << LLVoiceClientStatusObserver::status2string(status)  << ", session URI " << mSessionURI << llendl;
+	LL_DEBUGS("Voice") << " " << LLVoiceClientStatusObserver::status2string(status)  << ", session URI " << mSessionURI << LL_ENDL;
 
 	for (status_observer_set_t::iterator it = mStatusObservers.begin();
 		it != mStatusObservers.end();
diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp
new file mode 100644
index 00000000000..ff34fd27bea
--- /dev/null
+++ b/indra/newview/llwatchdog.cpp
@@ -0,0 +1,193 @@
+/** 
+ * @file llthreadwatchdog.cpp
+ * @brief The LLThreadWatchdog class definitions
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llwatchdog.h"
+
+// This class runs the watchdog timing thread.
+class LLWatchdogTimerThread : public LLThread
+{
+public:
+	LLWatchdogTimerThread() : 
+		LLThread("Watchdog"),
+		mSleepMsecs(0),
+		mStopping(false)
+	{
+	}
+            
+	~LLWatchdogTimerThread() {}
+    
+	void setSleepTime(long ms) { mSleepMsecs = ms; }
+	void stop() 
+	{
+		mStopping = true; 
+		ms_sleep(1);
+	}
+    
+	/* virtual */ void run()
+	{
+		while(!mStopping)
+		{
+			LLWatchdog::getInstance()->run();
+			ms_sleep(mSleepMsecs);
+		}
+	}
+
+private:
+	long mSleepMsecs;
+	bool mStopping;
+};
+
+// LLWatchdogEntry
+LLWatchdogEntry::LLWatchdogEntry()
+{
+}
+
+LLWatchdogEntry::~LLWatchdogEntry()
+{
+}
+
+void LLWatchdogEntry::start()
+{
+	LLWatchdog::getInstance()->add(this);
+}
+
+void LLWatchdogEntry::stop()
+{
+	LLWatchdog::getInstance()->remove(this);
+}
+
+// LLWatchdogTimeout
+LLWatchdogTimeout::LLWatchdogTimeout() : 
+	mTimeout(0.0f) 
+{
+}
+
+LLWatchdogTimeout::~LLWatchdogTimeout() 
+{
+}
+
+bool LLWatchdogTimeout::isAlive() const 
+{ 
+	return (mTimer.getStarted() && !mTimer.hasExpired()); 
+}
+
+void LLWatchdogTimeout::setTimeout(F32 d) 
+{
+	mTimeout = d;
+}
+
+void LLWatchdogTimeout::start() 
+{
+	// Order of operation is very impmortant here.
+	// After LLWatchdogEntry::start() is called
+	// LLWatchdogTimeout::isAlive() will be called asynchronously. 
+	mTimer.start(); 
+	mTimer.setTimerExpirySec(mTimeout); 
+	LLWatchdogEntry::start();
+}
+void LLWatchdogTimeout::stop() 
+{
+	LLWatchdogEntry::stop();
+	mTimer.stop();
+}
+
+void LLWatchdogTimeout::ping() 
+{ 
+	mTimer.setTimerExpirySec(mTimeout); 
+}
+
+// LlWatchdog
+LLWatchdog::LLWatchdog() :
+	mSuspectsAccessMutex(NULL),
+	mTimer(NULL)
+{
+}
+
+LLWatchdog::~LLWatchdog()
+{
+}
+
+void LLWatchdog::add(LLWatchdogEntry* e)
+{
+	mSuspectsAccessMutex->lock();
+	mSuspects.insert(e);
+	mSuspectsAccessMutex->unlock();
+}
+
+void LLWatchdog::remove(LLWatchdogEntry* e)
+{
+	mSuspectsAccessMutex->lock();
+    mSuspects.erase(e);
+	mSuspectsAccessMutex->unlock();
+}
+
+void LLWatchdog::init()
+{
+	mSuspectsAccessMutex = new LLMutex(NULL);
+	mTimer = new LLWatchdogTimerThread();
+	mTimer->setSleepTime(1000);
+	mTimer->start();
+}
+
+void LLWatchdog::cleanup()
+{
+	mTimer->stop();
+	delete mTimer;
+	delete mSuspectsAccessMutex;
+}
+
+void LLWatchdog::run()
+{
+	mSuspectsAccessMutex->lock();
+	
+	SuspectsRegistry::iterator result = 
+		std::find_if(mSuspects.begin(), 
+			mSuspects.end(), 
+			std::not1(std::mem_fun(&LLWatchdogEntry::isAlive))
+			);
+
+	if(result != mSuspects.end())
+	{
+		// error!!!
+		mTimer->stop();
+
+		llinfos << "Watchdog detected error:" << llendl;
+#ifdef LL_WINDOWS
+		RaiseException(0,0,0,0);
+#else
+		raise(SIGQUIT);
+#endif
+	}
+
+	mSuspectsAccessMutex->unlock();
+}
diff --git a/indra/newview/llwatchdog.h b/indra/newview/llwatchdog.h
new file mode 100644
index 00000000000..0d897ca4c91
--- /dev/null
+++ b/indra/newview/llwatchdog.h
@@ -0,0 +1,95 @@
+/** 
+ * @file llthreadwatchdog.h
+ * @brief The LLThreadWatchdog class declaration
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLTHREADWATCHDOG_H
+#define LL_LLTHREADWATCHDOG_H
+
+#ifndef LL_TIMER_H					
+	#include "lltimer.h"
+#endif
+
+// LLWatchdogEntry is the interface used by the tasks that 
+// need to be watched.
+class LLWatchdogEntry
+{
+public:
+	LLWatchdogEntry();
+	virtual ~LLWatchdogEntry();
+
+	// isAlive is accessed by the watchdog thread.
+	// This may mean that resources used by 
+	// isAlive and other method may need synchronization.
+	virtual bool isAlive() const = 0;
+	virtual void start();
+	virtual void stop();
+};
+
+class LLWatchdogTimeout : public LLWatchdogEntry
+{
+public:
+	LLWatchdogTimeout();
+	virtual ~LLWatchdogTimeout();
+
+	/* virtual */ bool isAlive() const;
+	/* virtual */ void start(); 
+	/* virtual */ void stop();
+
+	void setTimeout(F32 d);
+	void ping();
+
+private:
+	LLTimer mTimer;
+	F32 mTimeout;
+};
+
+class LLWatchdogTimerThread; // Defined in the cpp
+class LLWatchdog : public LLSingleton<LLWatchdog>
+{
+public:
+	LLWatchdog();
+	~LLWatchdog();
+
+	// Add an entry to the watchdog.
+	void add(LLWatchdogEntry* e);
+	void remove(LLWatchdogEntry* e);
+
+	void init();
+	void run();
+	void cleanup();
+    
+private:
+	typedef std::set<LLWatchdogEntry*> SuspectsRegistry;
+	SuspectsRegistry mSuspects;
+	LLMutex* mSuspectsAccessMutex;
+	LLWatchdogTimerThread* mTimer;
+};
+
+#endif // LL_LLTHREADWATCHDOG_H
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 6cc7e603a6b..a6fbe71d67f 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -87,7 +87,7 @@ LLWaterParamManager::~LLWaterParamManager()
 void LLWaterParamManager::loadAllPresets(const LLString& file_name)
 {
 	LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
-	llinfos << "Loading water settings from " << path_name << llendl;
+	LL_INFOS2("AppInit", "Shaders") << "Loading water settings from " << path_name << LL_ENDL;
 
 	//mParamList.clear();
 	
@@ -97,7 +97,7 @@ void LLWaterParamManager::loadAllPresets(const LLString& file_name)
 		std::string name;
 		found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
 
-		llinfos << "name: " << name << llendl;
+		LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
 		
 		// if we have one
 		if(found) 
@@ -112,7 +112,7 @@ void LLWaterParamManager::loadAllPresets(const LLString& file_name)
 			std::string water_name = unescaped_name.substr(0, unescaped_name.size() - 4);
 		
 			LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", name));
-			llinfos << "Loading water from " << cur_path << llendl;
+			LL_DEBUGS2("AppInit", "Shaders") << "Loading water from " << cur_path << LL_ENDL;
 			
 			std::ifstream water_xml(cur_path.c_str());
 			if (water_xml)
diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp
index 7a90be50b86..ca7c0f26a4a 100644
--- a/indra/newview/llwindebug.cpp
+++ b/indra/newview/llwindebug.cpp
@@ -35,7 +35,6 @@
 
 #include <tchar.h>
 #include <tlhelp32.h>
-#include "llappviewer.h"
 #include "llwindebug.h"
 #include "llviewercontrol.h"
 #include "lldir.h"
@@ -106,6 +105,8 @@ MINIDUMPWRITEDUMP f_mdwp = NULL;
 
 #undef UNICODE
 
+static LPTOP_LEVEL_EXCEPTION_FILTER gFilterFunc = NULL;
+
 HMODULE	hDbgHelp;
 
 // Tool Help functions.
@@ -554,14 +555,13 @@ void LLMemoryReserve::release()
 static LLMemoryReserve gEmergencyMemoryReserve;
 
 // static
-BOOL LLWinDebug::setupExceptionHandler()
+void  LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
 {
 
-	static BOOL s_first_run = TRUE;
+	static bool s_first_run = true;
 	// Load the dbghelp dll now, instead of waiting for the crash.
 	// Less potential for stack mangling
 
-	BOOL ok = TRUE;
 	if (s_first_run)
 	{
 		// First, try loading from the directory that the app resides in.
@@ -576,15 +576,7 @@ BOOL LLWinDebug::setupExceptionHandler()
 
 		if (!hDll)
 		{
-			llwarns << "Couldn't find dbghelp.dll!" << llendl;
-
-			std::string msg = "Couldn't find dbghelp.dll at ";
-			msg += local_dll_name;
-			msg += "!\n";
-
-			//write_debug(msg.c_str());
-
-			ok = FALSE;
+			LL_WARNS("AppInit") << "Couldn't find dbghelp.dll!" << LL_ENDL;
 		}
 		else
 		{
@@ -592,18 +584,15 @@ BOOL LLWinDebug::setupExceptionHandler()
 
 			if (!f_mdwp)
 			{
-				//write_debug("No MiniDumpWriteDump!\n");
 				FreeLibrary(hDll);
 				hDll = NULL;
-				ok = FALSE;
 			}
 		}
 
 		gEmergencyMemoryReserve.reserve();
-	}
 
-	LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
-	prev_filter = SetUnhandledExceptionFilter(LLWinDebug::handleException);
+		s_first_run = false;
+	}
 
 	// Try to get Tool Help library functions.
 	HMODULE hKernel32;
@@ -612,26 +601,44 @@ BOOL LLWinDebug::setupExceptionHandler()
 	Module32First_ = (MODULE32_FIRST)GetProcAddress(hKernel32, "Module32FirstW");
 	Module32Next_ = (MODULE32_NEST)GetProcAddress(hKernel32, "Module32NextW");
 
-	if (s_first_run)
+    LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
+	prev_filter = SetUnhandledExceptionFilter(filter_func);
+
+	if(prev_filter != gFilterFunc)
 	{
-		// We're fine, this is the first run.
-		s_first_run = FALSE;
-		return ok;
+		LL_WARNS("AppInit") 
+			<< "Replacing unknown exception (" << (void *)prev_filter << ") with (" << (void *)filter_func << ") !" << LL_ENDL;
 	}
-	if (!prev_filter)
+	
+	gFilterFunc = filter_func;
+}
+
+bool LLWinDebug::checkExceptionHandler()
+{
+	bool ok = true;
+	LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
+	prev_filter = SetUnhandledExceptionFilter(gFilterFunc);
+
+	if (prev_filter != gFilterFunc)
 	{
-		llwarns << "Our exception handler (" << (void *)LLWinDebug::handleException << ") replaced with NULL!" << llendl;
-		ok = FALSE;
+		LL_WARNS("AppInit") << "Our exception handler (" << (void *)gFilterFunc << ") replaced with " << prev_filter << "!" << LL_ENDL;
+		ok = false;
 	}
-	if (prev_filter != LLWinDebug::handleException)
+
+	if (prev_filter == NULL)
 	{
-		llwarns << "Our exception handler (" << (void *)LLWinDebug::handleException << ") replaced with " << prev_filter << "!" << llendl;
 		ok = FALSE;
+		if (gFilterFunc == NULL)
+		{
+			LL_WARNS("AppInit") << "Exception handler uninitialized." << LL_ENDL;
+		}
+		else
+		{
+			LL_WARNS("AppInit") << "Our exception handler (" << (void *)gFilterFunc << ") replaced with NULL!" << LL_ENDL;
+		}
 	}
 
 	return ok;
-	// Internal builds don't mess with exception handling.
-	//return TRUE;
 }
 
 void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename)
@@ -644,7 +651,7 @@ void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMAT
 	else
 	{
 		std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
-															   filename);
+																	   filename);
 
 		HANDLE hFile = CreateFileA(dump_path.c_str(),
 									GENERIC_WRITE,
@@ -672,20 +679,26 @@ void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMAT
 }
 
 // static
-LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
+void LLWinDebug::generateCrashStacks(struct _EXCEPTION_POINTERS *exception_infop)
 {
-	// *NOTE:Mani - This method is no longer the initial exception handler.
-	// It is called from viewer_windows_exception_handler() and other places.
+	// *NOTE:Mani - This method is no longer the exception handler.
+	// Its called from viewer_windows_exception_handler() and other places.
 
 	// 
 	// Let go of a bunch of reserved memory to give library calls etc
 	// a chance to execute normally in the case that we ran out of
 	// memory.
 	//
-	gEmergencyMemoryReserve.release();
+	LLSD info;
+	std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
+												"SecondLifeException");
+	std::string log_path = dump_path + ".log";
 
 	if (exception_infop)
 	{
+		// Since there is exception info... Release the hounds.
+		gEmergencyMemoryReserve.release();
+
 		if(gSavedSettings.getControl("SaveMinidump") != NULL && gSavedSettings.getBOOL("SaveMinidump"))
 		{
 			_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
@@ -698,67 +711,34 @@ LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
 			writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "SecondLifePlus.dmp");
 		}
 
-
-		std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
-															   "SecondLifeException");
-
-		std::string log_path = dump_path + ".log";
-
-		LLSD info;
 		info = Get_Exception_Info(exception_infop);
+	}
 
+	LLSD threads;
+    std::vector<DWORD> thread_ids;
+    GetProcessThreadIDs(GetCurrentProcessId(), thread_ids);
 
-        LLSD threads;
-        std::vector<DWORD> thread_ids;
-        GetProcessThreadIDs(GetCurrentProcessId(), thread_ids);
-
-        for(std::vector<DWORD>::iterator th_itr = thread_ids.begin(); 
-                 th_itr != thread_ids.end();
-                 ++th_itr)
+    for(std::vector<DWORD>::iterator th_itr = thread_ids.begin(); 
+                th_itr != thread_ids.end();
+                ++th_itr)
+    {
+        LLSD thread_info;
+        if(*th_itr != GetCurrentThreadId())
         {
-            LLSD thread_info;
-            if(*th_itr != GetCurrentThreadId())
-            {
-                GetThreadCallStack(*th_itr, thread_info);
-            }
-
-            if(thread_info)
-            {
-                
-                threads[llformat("ID %d", *th_itr)] = thread_info;
-            }
+            GetThreadCallStack(*th_itr, thread_info);
         }
 
+        if(thread_info)
+        {
+            threads[llformat("ID %d", *th_itr)] = thread_info;
+        }
+    }
 
-        info["Threads"] = threads;
-
-        if (info)
-		{
-			std::ofstream out_file(log_path.c_str());
-			LLSDSerialize::toPrettyXML(info, out_file);
-			out_file.close();
-		}
-	}
-	else
-	{
-		// We're calling this due to a network error, not due to an actual exception.
-		// It doesn't realy matter what we return.
-		return EXCEPTION_CONTINUE_SEARCH;
-	}
-
-	//handle viewer crash must be called here since
-	//we don't return handling of the application 
-	//back to the process. 
-	LLAppViewer::handleViewerCrash();
+    info["Threads"] = threads;
 
-	//
-	// At this point, we always want to exit the app.  There's no graceful
-	// recovery for an unhandled exception.
-	// 
-	// Just kill the process.
-	LONG retval = EXCEPTION_EXECUTE_HANDLER;
-	
-	return retval;
+	std::ofstream out_file(log_path.c_str());
+	LLSDSerialize::toPrettyXML(info, out_file);
+	out_file.close();
 }
 
 #endif
diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h
index bb1f11df674..f7543597cc7 100644
--- a/indra/newview/llwindebug.h
+++ b/indra/newview/llwindebug.h
@@ -38,10 +38,36 @@
 class LLWinDebug
 {
 public:
-	static BOOL setupExceptionHandler();
 
-	static LONG WINAPI handleException(struct _EXCEPTION_POINTERS *pExceptionInfo);
+
+	/** 
+	* @brief initialize the llwindebug exception filter callback
+	* 
+	* Hand a windows unhandled exception filter to LLWinDebug
+	* This method should only be called to change the
+	* exception filter used by llwindebug.
+	*
+	* Setting filter_func to NULL will clear any custom filters.
+	**/
+	static void initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func);
+
+	/** 
+	* @brief check the status of the exception filter.
+	*
+	* Resets unhandled exception filter to the filter specified 
+	* w/ initExceptionFilter). 
+	* Returns false if the exception filter was modified.
+	*
+	* *NOTE:Mani In the past mozlib has been accused of
+	* overriding the exception filter. If the mozlib filter 
+	* is required, perhaps we can chain calls from our 
+	* filter to mozlib's.
+	**/
+	static bool checkExceptionHandler();
+
+	static void generateCrashStacks(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
 	static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename);
+private:
 };
 
 #endif // LL_LLWINDEBUG_H
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index ea960b39cd2..5fb89907745 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -111,7 +111,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name)
 	if(file_name != "") 
 	{
 		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name));
-		llinfos << "Loading WindLight settings from " << path_name << llendl;
+		LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL;
 
 		llifstream presetsXML(path_name.c_str());
 	
@@ -137,7 +137,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name)
 	else
 	{
 		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
-		llinfos << "Loading WindLight settings from " << path_name << llendl;
+		LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL;
 	
 		//mParamList.clear();
 		
@@ -147,7 +147,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name)
 			std::string name;
 			found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
 
-			llinfos << "name: " << name << llendl;
+			LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
 			
 			// if we have one
 			if(found) 
@@ -162,7 +162,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name)
 				std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4);
 			
 				LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name));
-				llinfos << "Loading sky from " << cur_path << llendl;
+				LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL;
 				
 				std::ifstream sky_xml(cur_path.c_str());
 				if (sky_xml)
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index e2463adde3a..f1e0a6b55f7 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -1115,6 +1115,10 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data)
 
 void send_agent_pause()
 {
+	// *NOTE:Mani Pausing the mainloop timeout. Otherwise a long modal event may cause
+	// the thread monitor to timeout.
+	LLAppViewer::instance()->stopMainloopTimeout();
+	
 	// Note: used to check for LLWorld initialization before it became a singleton.
 	// Rather than just remove this check I'm changing it to assure that the message 
 	// system has been initialized. -MG
@@ -1170,6 +1174,8 @@ void send_agent_resume()
 
 	// Reset the FPS counter to avoid an invalid fps
 	LLViewerStats::getInstance()->mFPSStat.start();
+
+	LLAppViewer::instance()->startMainloopTimeout();
 }
 
 
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index fc4ede5bab3..9f1d8abca79 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -569,10 +569,10 @@ F64 LLXMLRPCTransaction::transferRate()
 	
 	double rate_bits_per_sec = impl.mTransferInfo.mSpeedDownload * 8.0;
 	
-	llinfos << "Buffer size:   " << impl.mResponseText.size() << " B" << llendl;
-	llinfos << "Transfer size: " << impl.mTransferInfo.mSizeDownload << " B" << llendl;
-	llinfos << "Transfer time: " << impl.mTransferInfo.mTotalTime << " s" << llendl;
-	llinfos << "Transfer rate: " << rate_bits_per_sec / 1000.0 << " Kb/s" << llendl;
+	LL_INFOS("AppInit") << "Buffer size:   " << impl.mResponseText.size() << " B" << LL_ENDL;
+	LL_DEBUGS("AppInit") << "Transfer size: " << impl.mTransferInfo.mSizeDownload << " B" << LL_ENDL;
+	LL_DEBUGS("AppInit") << "Transfer time: " << impl.mTransferInfo.mTotalTime << " s" << LL_ENDL;
+	LL_INFOS("AppInit") << "Transfer rate: " << rate_bits_per_sec / 1000.0 << " Kb/s" << LL_ENDL;
 
 	return rate_bits_per_sec;
 }
-- 
GitLab