0

Hi,
Am trying to log my traces using common logging with log4net, am able to get my traces by using log4net but on top of it when i try with common logging dll then could nt able to get my traces .advices will be helpful.

<configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net1213">
        <arg key="level" value="ALL" />
        <arg key="configType" value="INLINE" />
      </factoryAdapter>
    </logging>
  </common>

<log4net>
    <appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="applog.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>
    <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date{ABSOLUTE} [%thread] %level %logger - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="ALL" />
      <appender-ref ref="TraceAppender" />
      <appender-ref ref="FileAppender" />
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>

  public static class Test
    {
        private static ILog log = LogManager.GetLogger("FileAppender"); 
        public static DataSet GetLog(ConnectionInstance connection)
        {
         con.Connect();
                    log.Trace("Entered to View Pupil premium Log");
                     log.WarnFormat("Do Data -->No match for log ID and preview value for the Pupil Premium values!!");
        }
2
Contributors
1
Reply
6
Views
8 Months
Discussion Span
Last Post by rproffitt
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.