title: c# log4net how to get the file name
body: <p>I am using the RollingFileAppender to add the date to log file. At the end of a process, I want to email the log file. How can I get the file name that was dynamically created using netcore3.1?</p>
  <p>I have seen this answer from 2014, <a href="https://stackoverflow.com/questions/1343749/get-log4net-log-file-in-c-sharp">Get log4net log file in C#</a>. The .OfType no longer works.</p>
  <pre><code>  &lt;logger name=&quot;user_log&quot; additivity=&quot;false&quot;&gt;
      &lt;level value=&quot;Info&quot; /&gt;
      &lt;appender-ref ref=&quot;user_log&quot; /&gt;
    &lt;/logger&gt;
    &lt;appender name=&quot;user_log&quot; type=&quot;log4net.Appender.RollingFileAppender&quot;&gt;
      &lt;file value=&quot;c:\\logs\\csp\\process_csp_&quot; /&gt;
      &lt;datePattern value=&quot;yyyy-MM-dd'.log'&quot;/&gt;
      &lt;staticLogFileName value=&quot;false&quot; /&gt;
      &lt;appendToFile value=&quot;true&quot; /&gt;
      &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
        &lt;conversionpattern value=&quot;%date{yyyy-MM-dd HH:mm:ss} %-5level %message %newline&quot; /&gt;
      &lt;/layout&gt;
      &lt;lockingModel type=&quot;log4net.Appender.FileAppender+MinimalLock&quot; /&gt;
    &lt;/appender&gt;
  </code></pre>