Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Nijaz Hameed 30 posts 164 karma points
    Jan 25, 2024 @ 07:22
    Nijaz Hameed

    Logging custom directory path which is outside of the webroot not working

    Hi Umbracians,

    I am trying to provide a custom directory path which is outside of the webroot, lets say shared drive, like stated here, but still umbraco writes and read from the old path, what am i missing here?

    Actually I need to setup failover with 3 node clustering (Just failover not loadbalncing), And, I need to centralise the logging on a shared drive, for media it is working perfectly fine, but for logging with below settings seems not working, do you have any idea?

    "Logging": {
    "MaxLogAge": "2.00:00:00",
    "Directory": "C:/Work/POC/Test/Shared/umbraco/Logs"
  • Nijaz Hameed 30 posts 164 karma points
    Jan 30, 2024 @ 12:49
  • Nijaz Hameed 30 posts 164 karma points
    Jan 30, 2024 @ 13:37
    Nijaz Hameed

    A viable workaround solution involves leveraging Serilog sinks to facilitate writing logs to external paths.

    An illustrative example of configuring the Serilog file sync through app settings is provided below:

    An example for the serilog file sync appsetting config is below

    "WriteTo": [
            "Name": "File",
            "Args": {
              "Path": "C:\\Work\\POC\\Failover Test\\Shared\\umbraco\\Logs\\UmbracoTraceLog.%MACHINENAME%..json",
              "RollingInterval": "Day",
              "Formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact"
          { "Name": "Console" }

    To read the logs in umbraco logviewer from an external path, it's necessary to override the SerilogJsonLogViewer.cs class and inject the updated external path into the implementation. Make sure to register the dependency in composer.

  • Ashish 1 post 71 karma points
    6 days ago

    Hi Nijaz,

    I am using Umbraco 10 for .Net Core application and i was having requirement to save the logs on some shared location and your above solution worked. However now the problem is, in addition to the shared location, the logs are getting saved into the default location as well i.e. in umbraco/logs folder. So we can say that the logs are getting saved into two locations(shared folder and default folder) which is not deal.

    Could you please suggest if there is any configuration available to stop saving the logs into the default location i.e. umbraco/logs folder.

    Thanks, Ashish

Please Sign in or register to post replies

Write your reply to: