29

I have a unique identifier which goes through the whole application. I want this 'ID' to be logged as a separate property, so that it's easy to find out in log files or from the database.

Timo Tijhof
  • 10,032
  • 6
  • 34
  • 48
Miral
  • 5,968
  • 16
  • 57
  • 85

1 Answers1

41

You can use context properties e.g. like this:

ThreadContext.Properties["ID"] = yourID;

then you can access the property in the pattern string like this:

%property{ID}
Stefan Egli
  • 17,398
  • 3
  • 54
  • 75