log4net - configure using multiple configuration files

前端 未结 3 1504
感动是毒
感动是毒 2020-12-30 22:11

I have an application consisting of a host and pluggable modules (plugins).

I want to be able to configure log4net for the host and for each of the other modules. E

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 22:24

    It appears you already have found a solution that works for you. However, I've found a different solution which I consider to be "more ideal", so I'll post it here for whoever might find this question in the future.

    log4net has a concept called repositories which can be configured separately. It's not very popular nor very well documented, but here's some documentation I found:

    http://logging.apache.org/log4net/release/manual/repositories.html

    Anyway, all you need to do is add RepositoryAttribute on your plugin assembly or assemblies with a repository name unique to that plugin and log4net will keep it separate from everything else.

提交回复
热议问题