So I'm writing a WebApi using C#, I configured log4net in my web.config (used log4net.azure) my configuration is the following:
<appender name="AzureTableAppender" type="log4net.Appender.AzureTableAppender, log4net.Appender.Azure">
<param name="TableName" value="myLogs" />
<param name="ConnectionStringName" value="AzureTable" />
<param name="PropAsColumn" value="true" />
<bufferSize value="1" />
<param name="PartitionKeyType" value="LoggerName" />
</appender>
My issue is that I'm getting a lot of extra columns that I don't need, for now I'm getting the following:
I'm searching for a way to be able to pick which columns to be displayed and maybe add more columns but by code without going to my azure account and untick what I don't want.
Yes, you can control the columns to be displayed or not using code.
For example, assume that you wanna only have the 4 columns: Message / Level / RoleInstance / DeploymentId in your azure table storage, you can follow the steps:
Step 1.Create a table contanis the above 4 columns:
Step 2.Create a class, just use to create the table where stored your log. Here we named it Logger:
Step 3.define your custom appender:
Step 4.Test the code:
Step 5.My app.config as below:
Step 6.Nav to table, only the specified columns are added: