Base solution for your next web application
Open Closed

Adding the tenantId to the Logged information #721


User avatar
0
terrybentley created

I have an application using Log4Net posting to SQL Server database. Since it is a multi-tenant application I would like it to record the TenantId. I have added the column in the Log table and added in the log4net.config the @tenantId to the Insert command and added the entry <parameter> <parameterName value="@tenantId" /> <dbType value="Int32" /> <layout type="log4net.Layout.RawPropertyLayout" > <key value="tenantId"></key> </layout> </parameter>

How do I make the change to pass the tenantId through to the Logger?

Thanks... Terry


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    I've no experience on that. This is log4net specific stuff. As I search on the web, there are some answers:

    <a class="postlink" href="http://stackoverflow.com/questions/12139486/log4net-how-to-add-a-custom-field-to-my-logging">http://stackoverflow.com/questions/1213 ... my-logging</a> You can get value from AbpSession.TenantId as always.