Skip to content
Permalink
Browse files

Fix log location and setting settings from Desktop.

  • Loading branch information...
da3dsoul committed May 21, 2019
1 parent 08b624c commit 039980558c8c63d5de7952eda818a52b1f8a8dcc
@@ -20,6 +20,8 @@ static void Main(string[] args)
}
}
}

ShokoServer.Instance.InitLogger();

ServerSettings.LoadSettings();
ServerState.Instance.LoadSettings();
@@ -601,6 +601,8 @@ public CL_Response SaveServerSettings(CL_ServerSettings contractIn)
? contractIn.Plex_Sections.Split(',').Select(int.Parse).ToArray()
: new int[0];

// SAVE!
ServerSettings.Instance.SaveSettings();

if (anidbSettingsChanged)
{
@@ -130,6 +130,7 @@ public ActionResult ImportConfig(CL_ServerSettings settings)
try
{
ServerSettings.LoadSettingsFromFile(path, true);
ServerSettings.Instance.SaveSettings();
return APIStatus.OK();
}
catch
@@ -142,13 +142,6 @@ public List<ComponentVersion> GetVersion()
};
list.Add(version);

/*version = new ComponentVersion
{
version = Assembly.GetAssembly(typeof(INancyModule)).GetName().Version.ToString(),
name = "Nancy"
};
list.Add(version);*/

string dllpath = Assembly.GetEntryAssembly().Location;
dllpath = Path.GetDirectoryName(dllpath);
dllpath = Path.Combine(dllpath, "x86");
@@ -540,6 +533,7 @@ public ActionResult ImportConfig(CL_ServerSettings settings)
try
{
ServerSettings.LoadSettingsFromFile(path, true);
ServerSettings.Instance.SaveSettings();
return APIStatus.OK();
}
catch
@@ -20,6 +20,7 @@
using NLog;
using NLog.Extensions.Logging;
using NHibernate;
using NLog.Targets;
using NLog.Web;
using NutzCode.CloudFileSystem.OAuth2;
using Shoko.Commons.Properties;
@@ -110,6 +111,16 @@ public string[] GetSupportedDatabases()

private ShokoServer() { }

public void InitLogger()
{
var target = (FileTarget) LogManager.Configuration?.FindTargetByName("file");
if (target != null)
{
target.FileName = ServerSettings.ApplicationPath + "/logs/${shortdate}.log";
LogManager.ReconfigExistingLoggers();
}
}

public bool StartUpServer()
{
Analytics.PostEvent("Server", "Startup");
@@ -27,6 +27,7 @@ private void OnStartup(object a, StartupEventArgs e)
}
}
}
ShokoServer.Instance.InitLogger();
ServerSettings.LoadSettings();
var main = new MainWindow();
main.Show();

0 comments on commit 0399805

Please sign in to comment.
You can’t perform that action at this time.