1

Please let me know your thoughts on the below query,

During runtime, if I have to change the path where logs are written to a default path, how to implement the same using Microsoft Logging Application Block?

Assume, I'm writing the logs to a shared drive. Network is lost. From then on, I have to redirect the log writing process to my local path.

Thanks

1 Answers1

0

You can use special sources Logging Errors & Warnings as a fallback configuration.

Your configuration normally logs to a shared file trace listener. Additionally, when you configure a specialSource for Logging Errors & Warnings, it will first try to log to your shared file trace listener, if it fails, it will fallback to this flat file trace listener as you configured in Logging Errors & Warnings section.

For example:

<specialSources>
    <!-- other configurations related with unprocessed categories or all events can be placed here -->
    ....
    <!-- this will be in action when an error occurs during logging -->
    <errors switchValue="All" name="Logging Errors & Warnings">
     <listeners>
      <add name="Local File Trace Listener" />
     </listeners>
    </errors>

You can see here and here for more information.

Hasan
  • 676
  • 4
  • 10
  • This solution doesn't work once the network path is unavailable nothing is happening from what configured in – Venkatesh Jan 09 '18 at 07:40