0

I'm developping a WPF application using the MVVM pattern.

I would like to be able to collect usage data in order to be able to replay scenario that leads to bugs.

I assume that the the Viewmodel is the place to start, because this is where user interraction data comes in.

My idea is to start by logging all properties and methods calls along with important data. What do you think ? Any experience to share ?

TIA.

1 Answers1

0

It probably depends on how verbose you need those logs... Logging every single property and method call might have an impact on performance.
Also, when Binding to properties the GetValue gets called directly and not via the CLR property, so you won't really be getting ALL the calls...

Either way, the concept of logging the ViewModels is a good one. If all your VMs inherit from some sort of ViewModelBase, it'll be easy to implement the logging if you put it there.

I suggest you start by using a dedicated logging tool such as log4net. Use it for:

  • VM Creation
  • Calling of important methods
  • Exceptions
  • etc.

You can always go and log EVERY call to EVERY function, but it might be easier to log way-points along the way instead.

Community
  • 1
  • 1
Blachshma
  • 17,097
  • 4
  • 58
  • 72