Put log in more appropriate location

ad create log by default
This commit is contained in:
Sean Kaim
2016-05-18 17:13:59 -04:00
parent 0501d73e7b
commit b97fe50958
4 changed files with 14 additions and 10 deletions

View File

@@ -2,7 +2,11 @@
using log4net.Appender;
using log4net.Config;
using log4net.Repository;
#if !PORTABLE
using System;
#endif
using System.IO;
using System.Windows.Forms;
namespace mRemoteNG.App
{
@@ -47,12 +51,12 @@ namespace mRemoteNG.App
private static string BuildLogFilePath()
{
string logFilePath = "";
#if !PORTABLE
logFilePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), System.Windows.Forms.Application.ProductName);
#else
logFilePath = System.Windows.Forms.Application.StartupPath;
#endif
string logFileName = Path.ChangeExtension(System.Windows.Forms.Application.ProductName, ".log");
#if !PORTABLE
logFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName);
#else
logFilePath = Application.StartupPath;
#endif
string logFileName = Path.ChangeExtension(Application.ProductName, ".log");
string logFile = Path.Combine(logFilePath, logFileName);
return logFile;
}

View File

@@ -313,7 +313,7 @@ namespace mRemoteNG {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool WriteLogFile {
get {
return ((bool)(this["WriteLogFile"]));

View File

@@ -75,7 +75,7 @@
<Value Profile="(Default)" />
</Setting>
<Setting Name="WriteLogFile" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="UseCustomPuttyPath" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>

View File

@@ -20,7 +20,7 @@
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="${USERPROFILE}\AppData\Local\mRemoteNG\mRemoteNG.log"/>
<file value="${APPDATA}\mRemoteNG\mRemoteNG.log"/>
<!-- Example using environment variables in params -->
<!-- <file value="${TMP}\log-file.txt" /> -->
<appendToFile value="true"/>
@@ -109,7 +109,7 @@
<value />
</setting>
<setting name="WriteLogFile" serializeAs="String">
<value>False</value>
<value>True</value>
</setting>
<setting name="UseCustomPuttyPath" serializeAs="String">
<value>False</value>