Jelajahi Sumber

1.Manager App 启动进程成功,连接Linux服务器成功!
2.日志增加Log-All.txt,所有服务器进程日志全部打到这个文件,方便调试

tanghai 9 tahun lalu
induk
melakukan
fe9c821431

+ 7 - 0
Server/App/NLog.config

@@ -3,6 +3,12 @@
 <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<variable name="appType" value="" />
 	<variable name="appId" value="" />
+	<targets>
+		<target name="all" xsi:type="File"
+			fileName="${basedir}/Logs/Log-All.txt"
+			deleteOldFileOnStartup="false"
+			layout="${longdate} ${var:appType} ${var:appId} ${message}" />
+	</targets>
 	<targets>
 		<target name="debug" xsi:type="File"
 			fileName="${basedir}/Logs/Log-${var:appType}-${var:appId}-Debug.txt"
@@ -16,6 +22,7 @@
 			layout="${longdate} ${var:appType} ${var:appId} ${message}" />
 	</targets>
 	<rules>
+		<logger name="*" minlevel="Trace" writeTo="all" />
 		<logger name="*" minlevel="Debug" writeTo="debug" />
 		<logger name="*" minlevel="Error" writeTo="error" />
 	</rules>

+ 5 - 5
Server/App/Start.txt

@@ -1,5 +1,5 @@
-{ "_t" : "StartConfig", "Options" : { "_id" : 1, "AppType" : "Manager" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "127.0.0.1", "Port" : 10000 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "127.0.0.1", "Port" : 10001 }] } }
-{ "_t" : "StartConfig", "Options" : { "_id" : 2, "AppType" : "Realm" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "127.0.0.1", "Port" : 10002 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "127.0.0.1", "Port" : 10003 }] } }
-{ "_t" : "StartConfig", "Options" : { "_id" : 3, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "127.0.0.1", "Port" : 10004 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "127.0.0.1", "Port" : 10005 }] } }
-{ "_t" : "StartConfig", "Options" : { "_id" : 4, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "127.0.0.1", "Port" : 10006 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "127.0.0.1", "Port" : 10007 }] } }
-{ "_t" : "StartConfig", "Options" : { "_id" : 5, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "127.0.0.1", "Port" : 10008 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "127.0.0.1", "Port" : 10009 }] } }
+{ "_t" : "StartConfig", "Options" : { "_id" : 1, "AppType" : "Manager" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "192.168.12.188", "Port" : 10000 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "192.168.12.188", "Port" : 10001 }] } }
+{ "_t" : "StartConfig", "Options" : { "_id" : 2, "AppType" : "Realm" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "192.168.12.188", "Port" : 10002 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "192.168.12.188", "Port" : 10003 }] } }
+{ "_t" : "StartConfig", "Options" : { "_id" : 3, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "192.168.12.188", "Port" : 10004 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "192.168.12.188", "Port" : 10005 }] } }
+{ "_t" : "StartConfig", "Options" : { "_id" : 4, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "192.168.12.188", "Port" : 10006 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "192.168.12.188", "Port" : 10007 }] } }
+{ "_t" : "StartConfig", "Options" : { "_id" : 5, "AppType" : "Gate" }, "IP" : "*", "Config" : { "_id" : NumberLong("9223372036854775804"), "Type" : "StartConfig", "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("9223372036854775803"), "Host" : "192.168.12.188", "Port" : 10008 }, { "_t" : "OuterConfig", "_id" : NumberLong("9223372036854775802"), "Host" : "192.168.12.188", "Port" : 10009 }] } }

+ 0 - 1
Server/Controller/Message/C2G_LoginGateHandler.cs

@@ -9,7 +9,6 @@ namespace Controller
 	{
 		protected override void Run(Entity scene, C2G_LoginGate message, Action<G2C_LoginGate> reply)
 		{
-			Log.Info(MongoHelper.ToJson(message));
 			bool isCheckOK = Game.Scene.GetComponent<GateSessionKeyComponent>().Check(message.Key);
 			G2C_LoginGate g2CLoginGate = new G2C_LoginGate();
 			if (!isCheckOK)

+ 0 - 1
Server/Controller/Message/R2G_GetLoginKeyHandler.cs

@@ -9,7 +9,6 @@ namespace Controller
 	{
 		protected override void Run(Entity scene, R2G_GetLoginKey message, Action<G2R_GetLoginKey> reply)
 		{
-			Log.Info(MongoHelper.ToJson(message));
 			long key = Game.Scene.GetComponent<GateSessionKeyComponent>().Get();
 			G2R_GetLoginKey g2RGetLoginKey = new G2R_GetLoginKey(key);
 			reply(g2RGetLoginKey);

+ 4 - 5
Server/Model/Component/AppManagerComponent.cs

@@ -38,14 +38,14 @@ namespace Model
 
 
 #if __MonoCS__
-				const string exe = @"/usr/local/bin/mono";
+				const string exe = @"mono";
 				string arguments = $"App.exe --id={startConfig.Options.Id} --appType={startConfig.Options.AppType}";
-				const string workDir = @"../Server/Bin/Debug";
 #else
 				const string exe = @"App.exe";
 				string arguments = $"--id={startConfig.Options.Id} --appType={startConfig.Options.AppType}";
-				const string workDir = @"..\Server\Bin\Debug";
 #endif
+
+				Log.Info($"{exe} {arguments}");
 				try
 				{
 					ProcessStartInfo info = new ProcessStartInfo
@@ -53,8 +53,7 @@ namespace Model
 						FileName = exe,
 						Arguments = arguments,
 						CreateNoWindow = true,
-						UseShellExecute = true,
-						WorkingDirectory = workDir
+						UseShellExecute = true
 					};
 
 					Process process = Process.Start(info);

+ 0 - 1
Unity/Assets/Editor/RsyncEditor/RsyncEditor.cs

@@ -96,7 +96,6 @@ namespace MyEditor
 			if (GUILayout.Button("同步"))
 			{
 				string arguments = $"-vzrtopg --password-file=./Config/Rsync/rsync.secrets --exclude-from=./Config/Rsync/exclude.txt --delete ./ {this.rsyncConfig.Account}@{this.rsyncConfig.Host}::Upload/{this.rsyncConfig.RelativePath} --chmod=ugo=rwX";
-				Log.Debug(arguments);
 				ProcessStartInfo startInfo = new ProcessStartInfo();
 				startInfo.FileName = @".\Tools\cwRsync\rsync.exe";
 				startInfo.Arguments = arguments;

+ 1 - 1
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs

@@ -16,7 +16,7 @@ namespace MyEditor
 
 		private int copyNum = 1;
 
-		private string AppType = Model.AppType.Realm;
+		private string AppType = Model.AppType.Manager;
 
 		private readonly List<StartConfig> startConfigs = new List<StartConfig>();
 

+ 1 - 1
Unity/Controller/Event/InitSceneStartEvent_InitGame.cs

@@ -14,7 +14,7 @@ namespace Controller
 		{
 			Game.Scene.AddComponent<MessageDispatherComponent, string>("Client");
 			NetworkComponent networkComponent = Game.Scene.AddComponent<NetOuterComponent>();
-			Entity session = networkComponent.Get("127.0.0.1:10003");
+			Entity session = networkComponent.Get("192.168.12.188:10003");
 
 			try
 			{