Reputation: 789
I want to write logs to current date directory for ASP.NET site by using Log4Net
lib.
Like this:
<file value=".\Content\logs\{$currentDate}\TestLog.log" />
How I can do this?
Upvotes: 3
Views: 317
Reputation: 33326
You can use log4net.Util.PatternString
to do this, in your case do the following:
Remove this:
<file value="TestLog.log" />
And add this:
<file type="log4net.Util.PatternString" value=".\Content\logs\%date{yyyyMMdd}\\TestLog.log" />
For further info please refer to the documentation:
https://logging.apache.org/log4net/release/sdk/log4net.Util.PatternString.html
Upvotes: 3