Copied to clipboard

Flag this post as spam?

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


  • Jan A 63 posts 268 karma points
    Oct 19, 2016 @ 08:39
    Jan A
    0

    Multiple logging in root with glimpse

    I've installed Glimpse on umbraco to trace performace and I got it working. The problem is that the normal logging stopped.

    My log4net.config looks like this now

    <?xml version="1.0"?>
    <log4net>
      <root>
        <priority value="Info" />
        <appender-ref ref="AsynchronousLog4NetAppender" />
      </root>
      <!--To Change the way logging works for certain namespaces, insert a new logger like: -->
      <!--
        <logger name="Umbraco.Core">
            <level value="WARN" />
        </logger>-->
      <appender name="AsynchronousLog4NetAppender" type="Umbraco.Core.Logging.AsynchronousRollingFileAppender, Umbraco.Core">
        <file value="App_Data\Logs\UmbracoTraceLog.txt" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
        <appendToFile value="true" />
        <rollingStyle value="Date" />
        <maximumFileSize value="5MB" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
        </layout>
        <encoding value="utf-8" />
      </appender>
      <appender name="GlimpseAppender" type="Glimpse.Log4Net.Appender.GlimpseAppender" />
      <root name="glimpse7">
        <level value="ALL" />
        <appender-ref ref="GlimpseAppender" />
      </root>
    </log4net>
    

    I figure that having multiple root will not work well.

    Tried to look up how to change so that both glimpse and standard logging works, and I should move

    <appender-ref ref="AsynchronousLog4NetAppender" />
    

    to the second root and remove the first. But then all message will be logged, and that I don't want.

    I guess I should be able to specify in the appender AsynchronousLog4NetAppender what level it should run at, and the same for the glimpse?

    Some points to having a seperate logger tag, but then I need to specify when to use it so thats no good.

    I've seen posts that specify to set a filter in the "standard" appender

    <filter type="log4net.Filter.LevelRangeFilter">
                <levelMin value="INFO" />
                <levelMax value="FATAL" />
    </filter>
    

    I'm not sure if this will affect performance? Is there anyone that can point me to best practice?

Please Sign in or register to post replies

Write your reply to:

Draft