trace

log4net versus TraceSource [closed]

余生颓废 提交于 2019-11-27 09:12:16
问题 In this thread many people have indicated that they use log4net. I am a fan of TraceSources and would like to know why log4net is used. Here is why I like trace sources: Pluggable listeners - XML, TextFile, Console, EventLog, roll your own Customisable trace switches (error, warning, info, verbose, start, end, custom) Customisable configuration The Logging Application Block is just a big set of TraceListeners Correlation of activities/scopes (e.g., associate all logs within an ASP.NET request

How to track the execution process of ruby program

有些话、适合烂在心里 提交于 2019-11-27 08:09:20
问题 I am new to ruby and I want to track the execution process of ruby program when I feel confused about some programs. I wonder whether there is a way to help me track just as shell scripts set -x do? PS: Such as shell script test.sh: set -x ls /home echo "hello dujun and haotianma!" when I execute test.sh, then the output will be like: + ls /home dujun haotianma + echo 'hello dujun and haotianma!' hello dujun and haotianma! Just as how this bash script echos each statement before executing it,

Trace listener to write to a text box (WPF application)

孤人 提交于 2019-11-27 07:19:57
For my WPF application I do logging to a text file using a TextWriterTraceListener. How can I also display the Trace output to a textbox? I use this for C# winforms, should be easily adjustable to wpf public class MyTraceListener : TraceListener { private TextBoxBase output; public MyTraceListener(TextBoxBase output) { this.Name = "Trace"; this.output = output; } public override void Write(string message) { Action append = delegate() { output.AppendText(string.Format("[{0}] ", DateTime.Now.ToString())); output.AppendText(message); }; if (output.InvokeRequired) { output.BeginInvoke(append); }

Turning tracing off via app.config

喜夏-厌秋 提交于 2019-11-27 05:33:58
问题 I'm trying to use System.Diagnostics to do some very basic logging. I figure I'd use what's in the box rather than taking on an extra dependency like Log4Net or EntLib. I'm all set up, tracing is working wonderfully. Code snippet: Trace.TraceInformation("Hello World") App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <trace autoflush="true" indentsize="4"> <listeners> <add name="TraceListener" type="System.Diagnostics.TextWriterTraceListener"

How to use TraceSource across classes

老子叫甜甜 提交于 2019-11-27 05:12:43
问题 I was recently studying documentation on TraceSource. Microsift says that TraceSource is a new way and should be used instead of old Trace class. // create single TraceSource instance to be used for logging static TraceSource ts = new TraceSource("TraceTest"); // somewhere in the code ts.TraceEvent(TraceEventType.Warning, 2, "File Test not found"); Now my question. You have large project with several assemblies where you have lots of classes. Say you wanna trace specific bit of functionality

How can I monitor the SQL commands send over my ADO connection?

时光毁灭记忆、已成空白 提交于 2019-11-27 04:44:34
问题 i need intercept all the SQL commands that pass between an ADO connection component and a database server. something like the TSQLmonitor of dbExpress, but for ADO . Anybody know any third-party component that implements this functionality? UPDATE I want to do is to monitor the SQL statements programmatically (by code) from my application without using an external tool. for any database engine. 回答1: I found a solution, use the event TAdoConnection.OnWillExecute (Wich occurs after a database

How to print the next N executed lines automatically in GDB?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 03:25:55
I have been trying to find a way for some time to automate the progress in GDB of tracing the control flow of a program. Even just a simple way of automating the n command so you can see in what order routines are called. I realise that you can issues n x where x is the number of times GDB steps through, but the trouble with that is that it shows the command but not the address of the routine! But if you press n manually in GDB (then press return to issue the previous command) it shows the address. I have tried the following in GDB: (after setting a breakpoint at say 0x0123456) b *0x0123456

Extracting data used to make a smooth plot in mgcv

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 03:15:46
问题 This thread from a couple of years ago describes how to extract data used to plot the smooth components of a fitted gam model. It works, but only when there is one smooth variable. I've got more than one smooth variable, and unfortunately I can only extract the smooths from the last of the series. Here is an example: library(mgcv) a = rnorm(100) b = runif(100) y = a*b/(a+b) mod = gam(y~s(a)+s(b)) summary(mod) plotData <- list() trace(mgcv:::plot.gam, at=list(c(25,3,3,3)), #this gets you to

Counting machine instructions using gdb

扶醉桌前 提交于 2019-11-27 03:15:43
问题 I need to estimate the exact starting location of some hotspot in a program, in terms of x86 machine instruction count (so that it can later be run in some emulator/simulator). Is there a way to use gdb to count the number of machine instructions being executed up to a breakpoint? There are other alternatives of course, I could use a emulation / binary instrumentation tool (like Pin), and track the run while counting instructions, but that would require installing this tool on every platform

Current possibilities for tracing program flow in C#?

一笑奈何 提交于 2019-11-27 02:07:10
I have used Postsharp a few years ago to trace program flow during execution without needing to manually add trace statements to the methods. Is there any other new ways to trace execution to to debug output in a similar way? (Preferably a way that doesn't need to instrument the built assemblies. Maybe not possible?) If you only want this ability at debug time, there's Microsoft IntelliTrace that's a part of Visual Studio 2010 Ultimate, and there's Sergey Vlasov's RunTime Flow . The former makes your program run very slow. Haven't tried the latter. Gibraltar uses PostSharp, but provides you