3

I've seen a lot of sample configurations of NLog. I noticed that some of the loggers specified the target by using the appendTo attribute while others used the writeTo attribute.

I could not find any documentation explaining when to use one over the other. And I couldn't spot any obvious pattern.

I thought maybe it depended on the type of target, whether it was a file or console or something. But I've seen it use interchangeably in both cases.

For example in this StackOverflow thread you can see the examples all use writeTo exclusively:

Most useful NLog configurations

The second answer though uses appendTo.

This other question includes one of each in it's sample code:

How to get NLog to write to database

Are they interchangeable? Aliases for each other? Or are there specific cases when do use which?

Community
  • 1
  • 1
Luis Perez
  • 27,650
  • 10
  • 79
  • 80

1 Answers1

3

Are writeTo and appendTo aliases for each other?

Yes they are the same in the NLog logging-rules.

Julian
  • 33,915
  • 22
  • 119
  • 174
Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70
  • and both can be still used in NLog 4. If you define both in your config, the `appendTo` will be used. – Julian Mar 02 '17 at 20:22