Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Black Dragon Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Logue
Black Dragon Viewer
Commits
a6bc8499
Commit
a6bc8499
authored
8 years ago
by
Oz Linden
Browse files
Options
Downloads
Patches
Plain Diff
add logging around crash reporting, with minor code cleanups
parent
8b5a8e3b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcrashlogger/llcrashlogger.cpp
+36
-29
36 additions, 29 deletions
indra/llcrashlogger/llcrashlogger.cpp
indra/mac_crash_logger/mac_crash_logger.cpp
+0
-5
0 additions, 5 deletions
indra/mac_crash_logger/mac_crash_logger.cpp
with
36 additions
and
34 deletions
indra/llcrashlogger/llcrashlogger.cpp
+
36
−
29
View file @
a6bc8499
...
...
@@ -69,12 +69,15 @@ class LLCrashLoggerHandler : public LLHttpSDHandler
void
LLCrashLoggerHandler
::
onSuccess
(
LLCore
::
HttpResponse
*
response
,
const
LLSD
&
content
)
{
LL_DEBUGS
(
"CRASHREPORT"
)
<<
"Request to "
<<
response
->
getRequestURL
()
<<
"succeeded"
<<
LL_ENDL
;
gBreak
=
true
;
gSent
=
true
;
}
void
LLCrashLoggerHandler
::
onFailure
(
LLCore
::
HttpResponse
*
response
,
LLCore
::
HttpStatus
status
)
{
LL_WARNS
(
"CRASHREPORT"
)
<<
"Request to "
<<
response
->
getRequestURL
()
<<
" failed: "
<<
status
.
toString
()
<<
LL_ENDL
;
gBreak
=
true
;
}
...
...
@@ -230,8 +233,8 @@ void LLCrashLogger::gatherFiles()
LLCore
::
HttpRequest
::
GLOBAL_POLICY_ID
,
gDirUtilp
->
getCAFile
(),
NULL
);
}
LL_INFOS
()
<<
"Using log file from debug log "
<<
mFileMap
[
"SecondLifeLog"
]
<<
LL_ENDL
;
LL_INFOS
()
<<
"Using settings file from debug log "
<<
mFileMap
[
"SettingsXml"
]
<<
LL_ENDL
;
LL_INFOS
(
"CRASHREPORT"
)
<<
"Using log file from debug log "
<<
mFileMap
[
"SecondLifeLog"
]
<<
LL_ENDL
;
LL_INFOS
(
"CRASHREPORT"
)
<<
"Using settings file from debug log "
<<
mFileMap
[
"SettingsXml"
]
<<
LL_ENDL
;
}
else
{
...
...
@@ -267,25 +270,27 @@ void LLCrashLogger::gatherFiles()
for
(
std
::
map
<
std
::
string
,
std
::
string
>::
iterator
itr
=
mFileMap
.
begin
();
itr
!=
mFileMap
.
end
();
++
itr
)
{
std
::
ifstream
f
((
*
itr
).
second
.
c_str
());
if
(
!
f
.
is_open
())
{
LL_INFOS
(
"CRASHREPORT"
)
<<
"Can't find file "
<<
(
*
itr
).
second
<<
LL_ENDL
;
continue
;
}
std
::
stringstream
s
;
s
<<
f
.
rdbuf
();
if
(
f
.
is_open
())
{
std
::
stringstream
s
;
s
<<
f
.
rdbuf
();
std
::
string
crash_info
=
s
.
str
();
if
(
itr
->
first
==
"SecondLifeLog"
)
{
if
(
!
mCrashInfo
[
"DebugLog"
].
has
(
"StartupState"
))
{
mCrashInfo
[
"DebugLog"
][
"StartupState"
]
=
getStartupStateFromLog
(
crash_info
);
}
trimSLLog
(
crash_info
);
}
std
::
string
crash_info
=
s
.
str
();
if
(
itr
->
first
==
"SecondLifeLog"
)
{
if
(
!
mCrashInfo
[
"DebugLog"
].
has
(
"StartupState"
))
{
mCrashInfo
[
"DebugLog"
][
"StartupState"
]
=
getStartupStateFromLog
(
crash_info
);
}
trimSLLog
(
crash_info
);
}
mCrashInfo
[(
*
itr
).
first
]
=
LLStringFn
::
strip_invalid_xml
(
rawstr_to_utf8
(
crash_info
));
mCrashInfo
[(
*
itr
).
first
]
=
LLStringFn
::
strip_invalid_xml
(
rawstr_to_utf8
(
crash_info
));
}
else
{
LL_WARNS
(
"CRASHREPORT"
)
<<
"Can't find file "
<<
(
*
itr
).
second
<<
LL_ENDL
;
}
}
std
::
string
minidump_path
;
...
...
@@ -375,6 +380,7 @@ bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg
{
updateApplication
(
llformat
(
"%s, try %d..."
,
msg
.
c_str
(),
i
+
1
));
LL_INFOS
(
"CRASHREPORT"
)
<<
"POST crash data to "
<<
host
<<
LL_ENDL
;
LLCore
::
HttpHandle
handle
=
LLCoreHttpUtil
::
requestPostWithLLSD
(
httpRequest
.
get
(),
LLCore
::
HttpRequest
::
DEFAULT_POLICY_ID
,
0
,
host
,
data
,
httpOpts
,
LLCore
::
HttpHeaders
::
ptr_t
(),
LLCore
::
HttpHandler
::
ptr_t
(
new
LLCrashLoggerHandler
));
...
...
@@ -411,6 +417,8 @@ bool LLCrashLogger::sendCrashLog(std::string dump_dir)
"SecondLifeCrashReport"
);
std
::
string
report_file
=
dump_path
+
".log"
;
LL_DEBUGS
(
"CRASHREPORT"
)
<<
"sending "
<<
report_file
<<
LL_ENDL
;
gatherFiles
();
LLSD
post_data
;
...
...
@@ -425,11 +433,11 @@ bool LLCrashLogger::sendCrashLog(std::string dump_dir)
bool
sent
=
false
;
//*TODO: Translate
updateApplication
(
"DEBUG: crash host in send logs "
+
mCrashHost
);
if
(
mCrashHost
!=
""
)
{
std
::
string
msg
=
"Using
derived
crash server... "
;
if
(
mCrashHost
!=
""
)
{
LL_WARNS
(
"CRASHREPORT"
)
<<
"Sending crash data to server from CrashHostUrl '"
<<
mCrashHost
<<
"'"
<<
LL_ENDL
;
std
::
string
msg
=
"Using
override
crash server... "
;
msg
=
msg
+
mCrashHost
.
c_str
();
updateApplication
(
msg
.
c_str
());
...
...
@@ -469,11 +477,13 @@ bool LLCrashLogger::sendCrashLogs()
void
LLCrashLogger
::
updateApplication
(
const
std
::
string
&
message
)
{
if
(
!
message
.
empty
())
LL_INFOS
()
<<
message
<<
LL_ENDL
;
if
(
!
message
.
empty
())
LL_INFOS
(
"CRASHREPORT"
)
<<
message
<<
LL_ENDL
;
}
bool
LLCrashLogger
::
init
()
{
LL_DEBUGS
(
"CRASHREPORT"
)
<<
LL_ENDL
;
LLCore
::
LLHttp
::
initialize
();
// We assume that all the logs we're looking for reside on the current drive
...
...
@@ -497,7 +507,7 @@ bool LLCrashLogger::init()
// Set the log file to crashreport.log
LLError
::
logToFile
(
log_file
);
//NOTE: Until this line, LL_INFOS LL_WARNS, etc are blown to the ether.
LL_INFOS
()
<<
"Crash reporter file rotation complete."
<<
LL_ENDL
;
LL_INFOS
(
"CRASHREPORT"
)
<<
"Crash reporter file rotation complete."
<<
LL_ENDL
;
mCrashSettings
.
declareS32
(
"CrashSubmitBehavior"
,
CRASH_BEHAVIOR_ALWAYS_SEND
,
"Controls behavior when viewer crashes "
...
...
@@ -505,9 +515,6 @@ bool LLCrashLogger::init()
"1 = always send crash report, "
"2 = never send crash report)"
);
// LL_INFOS() << "Loading crash behavior setting" << LL_ENDL;
// mCrashBehavior = loadCrashBehaviorSetting();
init_curl
();
LLCore
::
HttpRequest
::
createService
();
LLCore
::
HttpRequest
::
startThread
();
...
...
This diff is collapsed.
Click to expand it.
indra/mac_crash_logger/mac_crash_logger.cpp
+
0
−
5
View file @
a6bc8499
...
...
@@ -45,11 +45,6 @@ int main(int argc, char **argv)
return
1
;
}
if
(
!
(
options
.
has
(
"pid"
)
&&
options
.
has
(
"dumpdir"
)))
{
LL_WARNS
()
<<
"Insufficient parameters to crash report."
<<
llendl
;
}
if
(
app
.
getCrashBehavior
()
!=
CRASH_BEHAVIOR_ALWAYS_SEND
)
{
// return NSApplicationMain(argc, (const char **)argv);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment