Log4Net available database fields for adoappender - seems there are a few more i.e. method_name?

别来无恙 提交于 2020-01-01 15:06:30

问题


I recently created my simple log4net database table for logging via the adonet appender.. and it works !

But then i notice another website using additional fields! Look!

Wow! i would love to know where i can get a list of available field names, for example Method_name really gets me thinking!!!

But logging normally supports adding to this field or do i need a wrapper or something?? i see via the log4net config it has the method_name point to the database field and has this

         "<conversionPattern value="%property{method_name}"/>"  

which is great but how do i populate this before calling the logger?

I was using a standard Thread, logger, message and exception FIELD NAMES ....

Anybody have a recommendation or experience in what esle i can log ... I would be great to be able to the log the method name, i am using the "LOGGER" field from GetType which gives me namespace and class...


回答1:


Here's a list of all the different values you can put into a conversion pattern.

Sounds like what you want is to use %method pattern:

<conversionPattern value="%method" />

You can also create custom properties and push them into the log4net context.

log4net.ThreadContext.Properties["custom"] = "Custom Value";

<conversionPattern value="%property{custom}" />


来源:https://stackoverflow.com/questions/1324604/log4net-available-database-fields-for-adoappender-seems-there-are-a-few-more-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!