pham cuong
pham cuong

Reputation: 861

Log4Net Dynamic logging folder path by exception

How can I configure logging folder path by specified exception using log4net ?

I wanna specify logging folder at exception level, not at Appender level. Something like that : "_log.Error(exception, {LogFolder});"

Upvotes: 2

Views: 102

Answers (1)

samy
samy

Reputation: 14962

It won't be really doable unless you write a custom appender for it. This appender could work on context variables to retrieve the desired folder: in this case you would need to use an event context

Another way would be to create as many appenders as needed for exceptions you're interested in and filter each appender by an exception. For that you would need to create a custom filter based on a FilterSkeleton

Upvotes: 1

Related Questions