Search code examples
.netenterprise-librarylogging-application-block

How to configure Enterprise Library formatters not to remove "new lines" from the logged message?


How to configure formatters not to remove "new lines" from the logged message?

logAttribute.Message="@p1='aa'\n@p2='bb'"

I want to find in the log:

@p1='aa'
@p2='bb'

Not

@p1='aa'@p2='bb'

Solution

  • Use a literal string and force the actual break. Not elegant, but will do the job.

    Alternatively, write your custom formatter.