Browse Source

Fixed a critical bug with patcher logs on a production server

main
Inga 🏳‍🌈 11 years ago
parent
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

2
Builder/IISMainHandler/build.txt

@ -1 +1 @@ @@ -1 +1 @@
1996
2000

8
FLocal.Patcher.Common/PatcherConfiguration.cs

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

6
Patcher.Web/CheckParams.cs

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

4
Patcher.Web/IPatcherConfiguration.cs

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

1
Patcher/Checker.cs

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

21
Patcher/Context.cs

@ -50,25 +50,4 @@ namespace Patcher @@ -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();
}
}
}
}

4
Patcher/ICheckParams.cs

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

39
Patcher/Logger.cs

@ -0,0 +1,39 @@ @@ -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();
}
}
}
}

1
Patcher/Patcher.csproj

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

1
Patcher/Updater.cs

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

2
export-info.bat

@ -2,4 +2,4 @@ @@ -2,4 +2,4 @@
svn export . exported
tree exported /f > Resources\FLocal\static\info\tree.txt
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