1

I am using ASP.NET MVC and servicestack.logging I used log4net. I want to log current user wit below code:

private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Logger.Info(session.UserAuthId.ToString());

And in web.config

    <appender type="log4net.Appender.RollingFileAppender" name="User_Log">
  <file value="C:\logs" />
  <datePattern value="dd.MM.yyyy'.log'" />
  <appendToFile value="true" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="10MB" />
  <staticLogFileName value="false" />

  <layout type="log4net.Layout.PatternLayout">
  </layout>
</appender>

But I see redundant logs in my text file:

How can I get rid of below message which are included inside my log.txt?

Registering Reply service 'WorkshopService' with request 'my web api name'
Registering OneWay service 'UploadService' with request 'my web api name'
Registering OneWay service 'PostmanService' with request 'Postman'
Initializing Application my application name Services took 1177.0709ms. No errors detected.

Any help? Thanks.

1 Answers1

1

These logging messages are only logged in DebugMode from the ServiceStack.Host.ServiceController type, to hide them don't enable the debug logger or filter logging messages from the specified type.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • Thank you so much for your answer. I also made a change by using **threshold** For one of my appender which I needed Debug and all `` For another appender which I needed just info `` –  Jun 28 '18 at 10:00