log4mongo/log4mongo-net

Custom Properties not being logged

Closed this issue · 1 comments

phber commented

Using the following schema:

<field>
    <name value="result" />
    <layout type="log4net.Layout.RawPropertyLayout">
      <key value="result" />
    </layout>
 </field>

Which is being called in code by:

ThreadContext.Properties["result"] = "Success";
log.Info("Test");

The custom property gets logged very capriciously, sometimes it's in the database - sometimes it's not.
I am calling the code through an ASP Web API, over HTTP.

phber commented

The issue was solved using GlobalContext instead in the Web API.