summaryrefslogtreecommitdiff
path: root/indra/llcommon/llerrorcontrol.h
AgeCommit message (Collapse)Author
2021-09-27SL-16093 Don't force the console window to be open on developer builds ↵Dave Parks
because it causes frame stalls while logging.
2021-05-11SL-10297: Move LL_ERRS crash location into the LL_ERRS macro itself.Nat Goodspeed
Introduce Oz's LLERROR_CRASH macro analogous to the old LLError::crashAndLoop() function. Change LL_ENDL macro so that, after calling flush(), if the CallSite is for LEVEL_ERROR, we invoke LLERROR_CRASH right there. Change the meaning of LLError::FatalFunction. It used to be responsible for the actual crash (hence crashAndLoop()). Now, instead, its role is to disrupt control flow in some other way if you DON'T want to crash: throw an exception, or call exit() or some such. Any FatalFunction that returns normally will fall into the new crash in LL_ENDL. Accordingly, the new default FatalFunction is a no-op lambda. This eliminates the need to test for empty (not set) FatalFunction in Log::flush(). Remove LLError::crashAndLoop() because the official LL_ERRS crash is now in LL_ENDL. One of the two common use cases for setFatalFunction() used to be to intercept control in the last moments before crashing -- not to crash or to avoid crashing, but to capture the LL_ERRS message in some way. Especially when that's temporary, though (e.g. LLLeap), saving and restoring the previous FatalFunction only works when the lifespans of the relevant objects are strictly LIFO. Either way, that's a misuse of FatalFunction. Fortunately the Recorder mechanism exactly addresses that case. Introduce a GenericRecorder template subclass, with LLError::addGenericRecorder(callable) that accepts a callable with suitable (level, message) signature, instantiates a GenericRecorder, adds it to the logging machinery and returns the RecorderPtr for possible later use with removeRecorder(). Change llappviewer.cpp's errorCallback() to an addGenericRecorder() callable. Its role was simply to update gDebugInfo["FatalMessage"] with the LL_ERRS message, then call writeDebugInfo(), before calling crashAndLoop() to finish crashing. Remove the crashAndLoop() call, retaining the gDebugInfo logic. Pass errorCallback() to LLError::addGenericRecorder() instead of setFatalFunction(). Oddly, errorCallback()'s crashAndLoop() call was conditional on a compile-time SHADER_CRASH_NONFATAL symbol. The new mechanism provides no way to support SHADER_CRASH_NONFATAL -- it is a Bad Idea to return normally from any LL_ERRS invocation! Rename LLLeapImpl::fatalFunction() to onError(). Instead of passing it to LLError::setFatalFunction(), pass it to addGenericRecorder(). Capture the returned RecorderPtr in mRecorder, replacing mPrevFatalFunction. Then ~LLLeapImpl() calls removeRecorder(mRecorder) instead of restoring mPrevFatalFunction (which, as noted above, was order-sensitive). Of course, every enabled Recorder is called with every log message. onError() and errorCallback() must specifically test for calls with LEVEL_ERROR. LLSingletonBase::logerrs() used to call LLError::getFatalFunction(), check the return and call it if non-empty, else call LLError::crashAndLoop(). Replace all that with LLERROR_CRASH. Remove from llappviewer.cpp the watchdog_llerrs_callback() and watchdog_killer_callback() functions. watchdog_killer_callback(), passed to Watchdog::init(), used to setFatalFunction(watchdog_llerrs_callback) and then invoke LL_ERRS() -- which seems a bit roundabout. watchdog_llerrs_callback(), in turn, replicated much of the logic in the primary errorCallback() function before replicating the crash from llwatchdog.cpp's default_killer_callback(). Instead, pass LLWatchdog::init() a lambda that invokes the LL_ERRS() message formerly found in watchdog_killer_callback(). It no longer needs to override FatalFunction with watchdog_llerrs_callback() because errorCallback() will still be called as a Recorder, obviating watchdog_llerrs_callback()'s first half; and LL_ENDL will handle the crash, obviating the second half. Remove from llappviewer.cpp the static fast_exit() function, which was simply an alias for _exit() acceptable to boost::bind(). Use a lambda directly calling _exit() instead of using boost::bind() at all. In the CaptureLog class in llcommon/tests/wrapllerrs.h, instead of statically referencing the wouldHaveCrashed() function from test.cpp, simply save and restore the current FatalFunction across the LLError::saveAndResetSettings() call. llerror_test.cpp calls setFatalFunction(fatalCall), where fatalCall() was a function that simply set a fatalWasCalled bool rather than actually crashing in any way. Of course, that implementation would now lead to crashing the test program. Make fatalCall() throw a new FatalWasCalled exception. Introduce a CATCH(LL_ERRS("tag"), "message") macro that expands to: LL_ERRS("tag") << "message" << LL_ENDL; within a try/catch block that catches FatalWasCalled and sets the same bool. Change all existing LL_ERRS() in llerror_test.cpp to corresponding CATCH() calls. In fact there's also an LL_DEBUGS(bad tag) invocation that exercises an LL_ERRS internal to llerror.cpp; wrap that too.
2020-09-25SL-13979 Crash of logging system at LLError::Settings::getInstance()Andrey Kleshchev
LLSingleton depends onto logging system, having logging system be based on LLSingleton causes crashes and deadlocks
2020-03-25DRTVWR-476: Make test program --debug switch work like LOGTEST=DEBUG.Nat Goodspeed
The comments within indra/test/test.cpp promise that --debug is, in fact, like LOGTEST=DEBUG. Until now, that was a lie. LOGTEST=level displayed log output on stderr as well as in testprogram.log, while --debug did not. Add LLError::logToStderr() function, and make initForApplication() (i.e. commonInit()) call that instead of instantiating RecordToStderr inline. Also call it when test.cpp recognizes --debug switch. Remove the mFileRecorder, mFixedBufferRecorder and mFileRecorderFileName members from SettingsConfig. That tactic doesn't scale. Instead, add findRecorder<RECORDER>() and removeRecorder<RECORDER>() template functions to locate (or remove) a RecorderPtr to an object of the specified subclass. Both are based on an underlying findRecorderPos<RECORDER>() template function. Since we never expect to manage more than a handful of RecorderPtrs, and since access to the deleted members is very much application setup rather than any kind of ongoing access, a search loop suffices. logToFile() uses removeRecorder<RecordToFile>() rather than removing mFileRecorder (the only use of mFileRecorder). logToFixedBuffer() uses removeRecorder<RecordToFixedBuffer>() rather than removing mFixedBufferRecorder (the only use of mFixedBufferRecorder). Make RecordToFile store the filename with which it was instantiated. Add a getFilename() method to retrieve it. logFileName() is now based on findRecorder<RecordToFile>() instead of mFileRecorderFileName (the only use of mFileRecorderFileName). Make RecordToStderr::mUseANSI a simple bool rather than a three-state enum, and set it immediately on construction. Apparently the reason it was set lazily was because it consults its own checkANSI() method, and of course 'this' doesn't acquire the leaf class type until the constructor has completed successfully. But since nothing in checkANSI() depends on anything else in RecordToStderr, making it static solves that problem.
2018-11-14Automated merge with ssh://bitbucket.org/lindenlab/viewer-releaseNat Goodspeed
2018-10-11Modify logging so that the in-viewer console and stderr do not escape line ↵Oz Linden
breaks Improve the implementation so that escaping is computed only once
2018-08-24SL-944 - logcontrol options to control which log recorders get used. This ↵Brad Payne (Vir Linden)
can be useful for performance reasons when especially verbose debug logging is needed.
2018-06-28DRTVWR-447: Suppress BugSplat UI; auto-fill certain BugSplat data.Nat Goodspeed
Direct BugSplat to send crash reports without prompting, on both Windows and Mac. Add a mechanism by which code called after LL_ERRS() can retrieve the fatal log message string. (How did the crash logger extract that for Linden crash logging?) Add that fatal message to crash reports on Windows. But as BugsplatMac is engaged only on the run _after_ the crash, we no longer have that message in memory. Also add user name and region location to Windows crash reports. On Mac, (a) we don't have the information from the previous run and (b) BugsplatMac doesn't provide an API to attach that information to the crash report. Add Mac logging to indicate the success or failure of sending the crash report. Add Windows logging to indicate we're about to send.
2017-02-27Look for logcontrol-dev.xml in the user settings directoryOz Linden
2016-08-30Automated merge with ssh://bitbucket.org/lindenlab/viewer-releaseNat Goodspeed
2015-11-10remove execute permission from many files that should not have itOz Linden
2015-06-25MAINT-5232: Try to avoid circularity between LLError and LLSingleton.Nat Goodspeed
Part of LLError's logging infrastructure is implemented with an LLSingleton. Therefore, attempts to log from within LLSingleton machinery could potentially go south if LLError's LLSingleton is not yet initialized. Introduce LLError::is_available() in llerrorcontrol.h and llerror.cpp. Make LLSingletonBase::logwarns() and logerrs() consult LLError::is_available() before attempting to use LL_WARNS or LL_ERRS, respectively. Moreover, make all LLSingleton internal logging use logwarns() and logerrs() instead of directly engaging LL_ERRS or LL_WARNS.
2014-05-17MAINT-4009: Final pass refactoring to eliminate memory allocation related to ↵Stinson Linden
error reporting that is not properly cleaned up.
2014-05-16MAINT-4009: First pass refactoring to eliminate memory related to error ↵Stinson Linden
reporting that is not properly cleaned up.
2013-08-12SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue ↵Richard Linden
bounces once per second SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary made llerrs/infos/etc properly variadic wrt tags LL_INFOS("A", "B", "C") works, for example fixed unit tests remove llsimplestat
2013-07-30Summer cleaning - removed a lot of llcommon dependencies to speed up build timesRichard Linden
consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders
2013-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2012-06-25merge up to 3.3.3-release + pathfindingOz Linden
2012-06-24Add logging during tests (debug level, to test-specific files)Oz Linden
2012-04-23IQA-463: LLError::addRecorder() claims ownership of passed Recorder*.Nat Goodspeed
That is, when the underlying LLError::Settings object is destroyed -- possibly at termination, possibly on LLError::restoreSettings() -- the passed Recorder* is deleted. There was much existing code that seemed as unaware of this alarming fact as I was myself. Passing to addRecorder() a pointer to a stack object, or to a member of some other object, is just Bad. It might be preferable to make addRecorder() accept std::auto_ptr<Recorder> to make the ownership transfer more explicit -- or even boost::shared_ptr<Recorder> instead, which would allow the caller to either forget or retain the passed Recorder. This preliminary pass retains the Recorder* dumb pointer API, but documents the ownership issue, and eliminates known instances of passing pointers to anything but a standalone heap Recorder subclass object.
2012-03-05Make test.cpp support LOGFAIL env var: only failed tests show log.Nat Goodspeed
Set LOGFAIL= one of ALL, DEBUG, INFO, WARN, ERROR, NONE. A passing test will run silently, as now; but a failing test will replay log output at the specified level or higher. While at it, support LOGTEST environment variable, same values. This is like setting --debug (or -d), but allows specifying an arbitrary level -- and, unlike --debug, can be set for a TeamCity build config without modifying any scripts or code. Publish LLError::decodeLevel(std::string), previously private to llerror.cpp.
2011-12-23STORM-1790 Provide a Develop sub-menu to change the default logging levelJonathan Yap
co-authored with Zi Ree
2010-08-13Change license from GPL to LGPL (version 2.1)Oz Linden
2009-10-13Fix signature of LLError::setTagLevel()Rick Pasetto
2009-09-01Merged login-api with viewer-2.0.0-3 up through r132290.brad kittenbrink
2009-08-29Partial merge of: viewer-2.0.0-3@131138 texture-pipeline-3@131862 -> ↵Steven Bennetts
viewer-2.0.0-3 Includes: * DEV-31909 VWR-13251: Revise lscript_library.cpp to allow localization of LSL editor hovertips * DEV-21938 llSHA1String does not appear where expected in the dropdown "Insert" menu in the LSL editor * Some cleanup to llerror so that it doesn't depend on llfixedbuffer * A few misc. server specific changes not related to the texture-pipeline changes (llapp, lloptioninterface)
2009-08-27Merged latest login-api with latest viewer-2.0.0-3 up through plugin-api-05 ↵brad kittenbrink
merge (r131929). Some minor post-merge cleanups still required.
2009-08-27svn merge -r 129841:129910 ↵Monroe Williams
svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/pluginapi_05-merge@129910 svn merge -r 129913:131718 svn+ssh://svn.lindenlab.com/svn/linden/branches/pluginapi/pluginapi_05 Some branch shenannigans in the pluginapi_05 branch caused this to become a two-part merge.
2009-06-04Merge of QAR-1383 event-system-7 into trunk.Brad Kittenbrink
svn merge -r 121797:121853 svn+ssh://svn.lindenlab.com/svn/linden/branches/merge-event-system-7
2009-05-22DEV-27646 dll linkage for login module.Brad Kittenbrink
Ok, finally got this to a point where it doesn't break the build and I can check in. llcommon can be built as a shared library (disabled but can be enabled with cmake cache var LLCOMMON_LINK_SHARED. reviewed by Mani on tuesday (I still need to get his suggested changes re-reviewed)
2009-05-08svn merge -r114679:114681 ↵Nat Goodspeed
svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-7 svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-8
2009-01-08Result of svn merge -r107256:107258 ↵Aaron Brashears
svn+ssh://svn/svn/user/phoenix/license_2009_merge into trunk. QAR-1165
2008-12-23QAR-1142 merging 1.22 RC0-RC4 changes.Mark Palange
svn merge -c 106471 svn+ssh://svn.lindenlab.com/svn/linden/qa/viewer_1-22-106055_merge
2007-10-04Result of svn merge -r71162:71205 ↵Aaron Brashears
svn+ssh://svn/svn/linden/branches/new-license into release. only changes files which are not deployed or the comments section of code.
2007-02-06merge in of error-refactor-3Mark Lentczner
concludes (fixes) SL-31187 pair programmed and reviewed by markl and karen