0

I'm trying to port my extension of Visual Studio from 2012 - 2013 to 2015. I have a log4net configuration file with the following section:

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
  <file value=".\mylog.log" /> 
  <appendToFile value="true" />
  <maximumFileSize value="1000KB" />
  <maxSizeRollBackups value="2" />

  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="[%d{ddMMM HH:mm:ss,fff}] %5level %logger (%line) - %message%newline" />
  </layout>
</appender>

In the previous versions of VS, I was able to find my logs under

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\log
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\log

but now there's nothing under

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\log

What's the best practice here (without carving a fixed path in the config file!!)?

Thank you!

Cristiano Ghersi
  • 1,944
  • 1
  • 20
  • 46
  • 2
    Programs should **not** write to Program Files, they should write to Application Data instead, which you can do in log4net using `${AppData}` or `${LocalAppData}` in the file value - [like in this question](http://stackoverflow.com/questions/24136199/how-to-create-a-file-in-the-appdata-folder-using-log4net) – stuartd Jul 09 '16 at 18:40

1 Answers1

0

You can use "DebugAppender" on your log4net configuration XML file.

<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
    <immediateFlush value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="*%-10level %-30date %message [%logger] [%thread] %newline" />
    </layout>
</appender>

This will output your log into the Ouput Console in VS.

like this

Cheers,