1

I don't want to use normal hierarchy rules dependent on code. Can I specify a custom one in log4net.config?

I mean that now hierarchy is automatically figured out by dots in logger name like First.Second.Third => First inherits root settings, Second inherits First, Third inherits Second, but assume I want to specify that First.Second.Third should inherit root2 settings. Is it possible?

I need this to remove duplication in logger settings where normally root settings are ok but for some loggers I want to specify other settings without doing it separately for each logger.

Vlad
  • 3,001
  • 1
  • 22
  • 52
  • You can only have one root element. – stuartd Aug 01 '16 at 09:28
  • @stuartd is it possible to have 2 "sub-roots" inherited by different loggers? – Vlad Aug 01 '16 at 12:52
  • Not _nicely_, as you would need to use the sub-root names in the logger names - so you would have `Root1.First.Second` and `Root2.First.Second.Third` which removes the convenience of just being able to use the enclosing type name as the logger name. – stuartd Aug 01 '16 at 13:03
  • @stuartd, I don't want to change logger names in code just to configure things in log4net.config – Vlad Aug 01 '16 at 14:06
  • of course not, which is what I was trying to say. One alternative might be to use [multiple repositories](http://stackoverflow.com/questions/36706713/log4net-logging-to-multiple-defined-appenders-using-class-name-loggers/36719549#36719549) – stuartd Aug 01 '16 at 14:25

0 Answers0