How to disable the stack trace in c++ glog? - c++11

I applied Glog to output some runtime information in my code, and I want to disable the stack trace function to protect the detail of the code. But I find the Glog is default to track the stack trace and log it to std err or log file, and there is no FLAGS_xx to disable it.
And I tried to #undef some of the stack trace related macro such as HAVE_STACKTRACE, but it doesn't work.
Do you have any elegant method to do this?

I use the GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)()); to install a customized function to output some customized information instead of the stack trace.
But in the std output there is still a line *** Check failure stack trace: *** to remind the user, and I don't know how to shut it down. It's not elegant enough.

Related

How to enable Performance logger in HCL Commerce 9.1

I want to generate trace for performance log but I don't find where enable the trace.
Checking this documentation page https://help.hcltechsw.com/commerce/9.1.0/admin/refs/rlsperflog_dup.html it's mention that we need to use the following string: com.ibm.commerce.performance=fine.
In Logging and Tracing settings we don't have this class path to enable finest log.
I tried to perform some run command in ts-app like:
run set-dynamic-trace-specification com.ibm.commerce.performance=fine
run set-server-property com.ibm.commerce.performance fine
Keep not seeing the trace file in: WAS_profiledir/logs/performanceTrace.json.
Some tip ?
Best Regards
Document found:
https://help.hcltechsw.com/commerce/9.1.0/admin/tasks/tlslogging_txn.html
Basically, it's activated by PMT logs.

How can I format my golang error logging so Google Cloud StackDriver identifies and parses it on GCE?

I've been trying to get StackDriver Error Reporting working on my golang project.
I'm running the logging agent on a vm in GCE. No matter what patterns I try it does not seem to pick it up, though it has picked up random bits of some of the stack traces, that seem to be something like
/^go:.*/
Below is an example of an error that Stack Driver picked up, and how it was mangled.
Raw Tab
router.go:16: goroutine 47 [running]:
github.com/org/repo/baserouter.RecoverFromPanic.func1.1(0x15267e0, 0xc420056340)
/home/myuser/go/src/github.com/org/repo/baserouter/router.go:14 +0xe2
panic(0xf6c320, 0xc4200120b0)
/opt/go-1.7.1/src/runtime/panic.go:458 +0x271
Title
go: 16
Parsed Stack Trace Tab
"not available"
How can I log out an error and a stack trace via the agent so StackDriver picks it up and parses it properly?

How to go stack traces from `polyc`?

I am using PolyML compiler 5.6 Release on Mac OS. I'm compiling and running some code which raises an exception (Fail "undefined"). I am expecting my compiled app to exit with a stack trace when the exception is raised; but instead it exits silently.
How can I get PolyML to show stack traces or at least line numbers where the exception is raised?
Running your application under the debugger is the best way to find out where the exception is happening.
If you can't or don't want to use the debugger you can get line number and source file information by adding a handler and using PolyML.Exception.exceptionLocation to get the location from the exception packet. See http://polyml.org/documentation/Reference/PolyMLException.html
In Poly/ML 5.6 you can also use PolyML.exception_trace to get a trace of the calls that led to the exception but that's likely to be removed in the next release,

How can you force a dump of a Go program on windows?

I'm looking to do some kind of debugging on windows where the state of the service appears to be a deadlock. Perhaps the approach would be to do a dump. How can you do a program dump of a Go service? And then analyze that dump?
I've done this using the runtime.Stack function. Its output is equivalent to what you get from a panic(), but without halting the program. You can set up a signal handler to dump the stack to a file/stdout, or start a goroutine to dump the stack at regular intervals, if you prefer.
You could also check out the runtime/debug package.
Goroutine deadlock analysis is handled well using the trace command.
First, you need to get data to run a trace against, which you want at any point. You can get this by using the pprof package or the trace package.
https://golang.org/pkg/net/http/pprof/
https://golang.org/pkg/runtime/trace/
The pprof package will add its HTTP handlers to a web server and let you collect trace data while the app is running, while the trace package lets you write out a trace to a stream (e.g. a file), but I haven't tried that myself.
Once you've collected trace data, you can run the trace command against the data you've collected to produce a web view of the state:
https://golang.org/cmd/trace/
There's an example output here:
https://talks.golang.org/2015/dynamic-tools.slide#30

How to get JavaMail trace in EBCDIC?

I've turned on tracing my JavaMail-based application, and I can see the trace, but it looks like garbage because it is in unicode and my machine only knows EBCDIC. Is there anyway I can get the trace to print out with the default encoding for my machine (EBCDIC)? Here is how I activate the trace:
session.setDebug(true);
By default the trace goes to System.out. If System.out isn't converting to EBCDIC, you can create your own PrintStream that does so and use the session.setDebugOut(ps) method to set it.

Resources