How to debug in Tryton? - debugging

I'm trying to found a more detailed and focused way to get error message from views in Tryton Client for speed development. I'm using
tryton -v -d -l DEBUG
but only bring UNICODE strings arriving to client. Is there a better approach?

I usually work with eclipse and pydev plugin. The installation is the same as OpenERP [1].
[1] http://domatix.com/entorno-desarrollo-eclipse-openerp-parte-tres/

Just like the client, the server can be run in verbose mode where stack traces are sent out to stderr and stdout. But this stack trace is no different from the unicode stack trace displayed by the tryton client. So the better way to debug once you find such an error would be to set a breakpoint around the code where the stacktrace frame indicates the exception occurred.
See: https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ for a quick guide on pdb if you are using pdb for the first time.
OTOH, if you want to capture more information in production when exceptions occur, use the trytond-sentry integration module(See: http://www.openlabs.co.in/article/sentry-tryton-v-1-0)

Related

Definition of debugging, profiling and tracing

Being new to systematic debugging, I asked myself what these three terms mean:
Debugging
Profiling
Tracing
Anyone could provide definitions?
Well... as I was typing the tags for my question, it appeared that stack overflow already had defined the terms in the tags description. Here their definitions which I found very good:
Remote debugging is the process of running a debug session in a local development environment attached to a remotely deployed application.
Profiling is the process of measuring an application or system by running an analysis tool called a profiler. Profiling tools can focus on many aspects: functions call times and count, memory usage, cpu load, and resource usage.
Tracing is a specialized use of logging to record information about a program's execution.
In addition to the answer from Samuel:
Debugging is the process of looking for bugs and their cause in applications. a bug can be an error or just some unexpected behaviour (e.g. a user complains that he/she receives an error when he/she uses an invalid date format). typically a debugger is used that can pause the execution of an application, examine variables and manipulate them.
Profiling is a dynamic analysis process that collects information about the execution of an application. the type of information that is collected depends on your use case, e.g. the number of requests. the result of profiling is a profile with the collected information. the source for a profile can be exact events (see tracing below) or a sample of events that occured.
because the data is aggregated in a profile it is irrelevant when and in which order the events happened.
Tracing "trace is a log of events within to the program"(Whitham). those events can be ordered chronologically. thats why they often contain a timestamp. Tracing is the process of generating and collecting those events. the use case is typically flow analysis.
example tracing vs profiling:
Trace:
[2021-06-12T11:22:09.815479Z] [INFO] [Thread-1] Request started
[2021-06-12T11:22:09.935612Z] [INFO] [Thread-1] Request finished
[2021-06-12T11:22:59.344566Z] [INFO] [Thread-1] Request started
[2021-06-12T11:22:59.425697Z] [INFO] [Thread-1] Request finished
Profile:
2 "Request finished" Events
2 "Request started" Events
so if tracing and profiling measure the same events you can construct a profile from a trace but not the other way around.
source
Whitham: https://www.jwhitham.org/2016/02/profiling-versus-tracing.html
IPM: http://ipm-hpc.sourceforge.net/profilingvstracing.html

Trace loss in LTTng

I am using Lttng in an application. I have enabled heavy traces and I have found that there is a loss in traces. Is there any way of knowing if there is any trace loss or any information regarding about it . Are there any API calls to know about them.
Thanks & Regards.,
K.V.Ranganadh.
Both viewers for LTTng traces should both be able to report if a trace has lost events in them.
Babeltrace, the command-line trace reading tool, prints lost events on stderr. So a quick way to locate these is to reroute stdout elsewhere, so you only see the lost events in the console, using a command like:
babeltrace /path/to/trace > /dev/null
Alternatively, the graphical viewer Trace Compass displays lost events in its Statistics View.
In general, lost events happen when the machine is too loaded and the tracer cannot keep up with the events coming in. To reduce the chance of losing events, you can look at increasing the subbuffer sizes and number (see the 'lttng' man page), or enabling less events in your tracing session (instead of doing 'lttng enable-event ... -a', only enable the events you need).

Websphere console - Monitor server events such as server restart

I am absolutely not familiar with WebSphere and haven't found anything about this within the last 30 of minutes web research.
Is there a view where i can obtain a list of server events such as starts-, stops- or restarts in the web console of a WAS 8.5 application server?
What i tried:
30 Minute Web research.
My workaround :I always used our Splunk to filter for example "Starting Application..." to identify the time a Application was started based on the log events. I apply similar filters to recognize server restarts.
By default there is no such view. There are at least 2 potential solutions, that you could use, but your workaround might be easier ;-) :
Enable Runtime Messages
In the web console go to Troubleshooting > Runtime Messages > Runtime information.
Enable Info level, save and restart. Then you will be able to filter massages using filter in the table and providing message fragment.
Use HPEL logging and filtering
You can switch default logging to HPEL in the Logging and tracing > server1 > Switch to HPEL. After that your logging will be done in binary form (much better performance) and you will be able to do searches based on the event code, message content etc. You will be able to view log either from the console Logging and tracing > server1 > JVM Logs > Runtime with search/filtering capability, or from command line using logviewer tool. Tool can be used a bit like tail/grep combination and print only relevant information or information from specified application. In this case you will also be able to view past events also, as in Runtime messages you see only events from server startup.
Custom MBean listener
You could write code to listen on events generated by the server, but probably too much effort for your need.
See also:
Runtime events
HPEL overview
LogViewer tool

How to see stack trace of test code of Go program?

I use Go's native test facility (go test) to write a test. But when the test fails due to a bug in test code, I really can't debug it due to lack of stack trace or any other contextual informations.
And even, the test code needs one contextual object t, so it is not simple work running the test code in normal mode.
What is the best practice to debug test code?
You can log stack trace this way
t.Log(string(debug.Stack()))
Documentation is here https://golang.org/pkg/runtime/debug/#Stack
It is better than PrintStack because it doesn't interfere with regular test logs.
You can use t.Log() to log information about the test case -- go will show that output if the test case fails or if you run go test -v
You can also assert certain state within the test using panics -- if a test panics, you will see the trace in your console.
I don't know if you'd want to check in code with this in it, but for one-off debugging, PrintStack might help. http://golang.org/pkg/runtime/debug/#PrintStack

Debug AIR Application on Client Machine

I have an AIR application that is causing me problems on a single client machine, and on a specific user account.
I have a debug interface that I developed to print traces to but apparently you can not get stack traces when not in a debugging environment.
I am seeing "TypeError #2007" with no additional information. I tried to output the error text using e.getStackTrace() and it returns null.
How can I get more information about this error on a client machine?
In this instance I was able to isolate the problem using a bunch of different try..catch statements and a lot of trace statements.
It took a lot of persistence and a lot of back and forth installing many different versions on the client machine and testing.
Obviously not an optimal solution in most cases, but one that worked.

Resources