Copied to clipboard

Flag this post as spam?

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


  • Zihadul Azam 26 posts 171 karma points c-trib
    Jul 06, 2018 @ 07:45
    Zihadul Azam
    0

    Hii,

    I'm trying to log my controller's steps with LogHepler.

    LogHelper.Info(GetType(), "Configuration started");
    

    When I call this controller, run all code correctly, but strangely not write my custom logs to App_Data/Logs/UmbracoTraceLog.xx.txt log file.

    (Note: I'm in Debug solution mode with Visual Studio)

    -thanks

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jul 06, 2018 @ 08:22
    Hendy Racher
    0

    Hi Zihadul,

    Are there any configuration changes to ~/config/log4net.config which might instruct the logs to persist elsewhere ? (assuming your web.config appSetting "log4net.Config" points to this file)

  • Zihadul Azam 26 posts 171 karma points c-trib
    Jul 06, 2018 @ 08:31
    Zihadul Azam
    0

    Hi Hendry,

    my log4net.config file has this:

    <?xml version="1.0"?>
    <log4net>
    
      <root>
        <priority value="Info"/>
        <appender-ref ref="AsynchronousLog4NetAppender" />
      </root>
    
      <appender name="rollingFile" type="log4net.Appender.RollingFileAppender">
          <file type="log4net.Util.PatternString" value="App_Data\Logs\UmbracoTraceLog.%property{log4net:HostName}.txt" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
        <appendToFile value="true" />
        <rollingStyle value="Date" />
        <maximumFileSize value="5MB" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value=" %date [P%property{processId}/D%property{appDomainId}/T%thread] %-5level %logger - %message%newline" />
        </layout>
        <encoding value="utf-8" />
      </appender>
    
      <appender name="AsynchronousLog4NetAppender" type="Log4Net.Async.ParallelForwardingAppender,Log4Net.Async">
        <appender-ref ref="rollingFile" />
      </appender>
    
      <!--Here you can change the way logging works for certain namespaces  -->
    
      <logger name="NHibernate">
        <level value="WARN" />
      </logger>
    
    
    </log4net>
    

    Then, Umbraco's default logs are writing correctly, only my custom logs are missing.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jul 06, 2018 @ 09:01
    Hendy Racher
    0

    That looks like the default Umbraco configuration and should log Info level events, so I'm not sure what to suggest :(

Please Sign in or register to post replies

Write your reply to:

Draft