Fixed a critical bug with patcher logs on a production server

main
Inga 🏳‍🌈 13 years ago
parent 7060b3899a
commit 0605088dfc
  1. 2
      Builder/IISMainHandler/build.txt
  2. 8
      FLocal.Patcher.Common/PatcherConfiguration.cs
  3. 6
      Patcher.Web/CheckParams.cs
  4. 4
      Patcher.Web/IPatcherConfiguration.cs
  5. 1
      Patcher/Checker.cs
  6. 21
      Patcher/Context.cs
  7. 4
      Patcher/ICheckParams.cs
  8. 39
      Patcher/Logger.cs
  9. 1
      Patcher/Patcher.csproj
  10. 1
      Patcher/Updater.cs
  11. 2
      export-info.bat

@ -39,6 +39,13 @@ namespace FLocal.Patcher.Common {
} }
} }
private readonly string _LogDir;
public string LogDir {
get {
return this._LogDir;
}
}
public IEnumerable<PatchId> getPatchesList() { public IEnumerable<PatchId> getPatchesList() {
return PatchesLoader.getPatchesList(); return PatchesLoader.getPatchesList();
} }
@ -52,6 +59,7 @@ namespace FLocal.Patcher.Common {
this._EnvironmentName = data["Patcher.EnvironmentName"].ToString(); this._EnvironmentName = data["Patcher.EnvironmentName"].ToString();
this._GuestConnectionString = data["ConnectionString"].ToString(); this._GuestConnectionString = data["ConnectionString"].ToString();
this._PatchesTable = data["Patcher.PatchesTable"].ToString(); this._PatchesTable = data["Patcher.PatchesTable"].ToString();
this._LogDir = Path.Combine(data["DataDir"], "Logs");
} }
public static void Init(NameValueCollection data) { public static void Init(NameValueCollection data) {

@ -35,5 +35,11 @@ namespace Patcher.Web {
return this.configuration.getPatchesList(); return this.configuration.getPatchesList();
} }
public string LogDir {
get {
return this.configuration.LogDir;
}
}
} }
} }

@ -28,5 +28,9 @@ namespace Patcher.Web {
Stream loadPatch(PatchId patchId); Stream loadPatch(PatchId patchId);
string LogDir {
get;
}
} }
} }

@ -15,6 +15,7 @@ namespace Patcher {
private readonly ICheckParams checkParams; private readonly ICheckParams checkParams;
public Checker(ICheckParams checkParams) { public Checker(ICheckParams checkParams) {
Logger.LogDir = checkParams.LogDir;
this.checkParams = checkParams; this.checkParams = checkParams;
} }

@ -50,25 +50,4 @@ namespace Patcher
} }
class Logger : ILogger {
public static readonly ILogger instance = new Logger();
private readonly StreamWriter writer;
private readonly object locker = new object();
private Logger() {
this.writer = new StreamWriter("C:\\Program Files\\FLocal\\main\\debug\\data\\Logs\\" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".patcher.txt");
}
void ILogger.Log(string message) {
lock(this.locker) {
this.writer.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff") + ": " + message);
this.writer.Flush();
}
}
}
} }

@ -26,5 +26,9 @@ namespace Patcher
IEnumerable<PatchId> getPatchesList(); IEnumerable<PatchId> getPatchesList();
string LogDir {
get;
}
} }
} }

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Web.Core;
namespace Patcher {
class Logger : ILogger {
public static string LogDir {
set {
lock(_instance.locker) {
_instance.writer = new StreamWriter(Path.Combine(value, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".patcher.txt"));
}
}
}
private static readonly Logger _instance = new Logger();
public static readonly ILogger instance = _instance;
private StreamWriter writer;
private readonly object locker = new object();
private Logger() {
}
void ILogger.Log(string message) {
lock(this.locker) {
this.writer.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff") + ": " + message);
this.writer.Flush();
}
}
}
}

@ -96,6 +96,7 @@
<Compile Include="Exceptions\ResourceNotFoundException.cs" /> <Compile Include="Exceptions\ResourceNotFoundException.cs" />
<Compile Include="Exceptions\XmlResourceNotFoundException.cs" /> <Compile Include="Exceptions\XmlResourceNotFoundException.cs" />
<Compile Include="IUpdateParams.cs" /> <Compile Include="IUpdateParams.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Updater.cs" /> <Compile Include="Updater.cs" />
<Compile Include="ICheckParams.cs" /> <Compile Include="ICheckParams.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -22,6 +22,7 @@ namespace Patcher
private readonly Context context; private readonly Context context;
public Updater(IUpdateParams updateParams, IInteractiveConsole console) { public Updater(IUpdateParams updateParams, IInteractiveConsole console) {
Logger.LogDir = updateParams.LogDir;
this.context = new Context(updateParams, console); this.context = new Context(updateParams, console);
} }

@ -2,4 +2,4 @@
svn export . exported svn export . exported
tree exported /f > Resources\FLocal\static\info\tree.txt tree exported /f > Resources\FLocal\static\info\tree.txt
rmdir /s /q exported rmdir /s /q exported
svn log -r HEAD:0 -v > Resources\FLocal\static\info\svnlog.txt svn log -r HEAD:0 -v .. > Resources\FLocal\static\info\svnlog.txt

Loading…
Cancel
Save