Visual Studio debug log (like logcat in Android)?

You can set a breakpoint that doesn't actually break, but outputs a log message instead. Just set a breakpoint, then right click on the breakpoint and select "When Hit...".

From that dialog select "Print a message" and "continue execution"

Dialog screenshot


There isn't really anything built in exactly like logcat, but there are lots of logging frameworks that you can use.

Personally, I like to use NLog and set up a UDP target for tracing/debugging within my configuration file along with a rule to forward all loggers to the target. I think that NLog is easier to use than Log4Net (the .NET port of Log4j). Once you do this you can create a logger from the manager and call the logger just like LogCat in android:

Logger logger = LogManager.GetLogger("MyClassTag");

logger.Trace("Something to log");
logger.Debug("Something to log");
logger.Info("Something to log");
logger.Warn("Something to log");
logger.Error("Something bad to log", exception);
logger.Fatal("Something bad to log", exception);

For listening to the UDP logging packets I use Log2Console which allows me to view them just like android's logcat viewer.


For whatever reason, this question was at the top of my Google search when looking for something similar (though it's 5 years old), so in case anyone else comes across it, this is the easiest method I've encountered:

Debug.WriteLine("hit checkpoint X");

It's included in System.Diagnostics, so you'll need a using System.Diagnostics at the top of your file, but that's all you need.