I am trying to write a C# code, which retrieves in runtime the name pattern of a log4net log file via the log4net API.
That is, if in log4net.config the following appender is defined:
<appender name="MyAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="%date{yyyy}\%date{MM}\%date{dd}\%property{Id}.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="16" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message%newline" />
</layout>
</appender>
I would like to get %date{yyyy}\%date{MM}\%date{dd}\%property{Id}.log in a string variable in code (without parsing log4net.config as a plain XML).
Does anybody has an idea ho to pull this trick?
Thank you in advance.