using ExitGames.Concurrency.Fibers; using ExitGames.Logging; using ExitGames.Logging.Log4Net; using log4net.Config; using Photon.SocketServer; using Photon.SocketServer.ServerToServer; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Remoting; using System.Text; using System.Threading.Tasks; namespace OHAGameServer { class SimpleServer : ApplicationBase { private readonly ILogger log = LogManager.GetCurrentClassLogger(); protected override PeerBase CreatePeer(InitRequest initRequest) { return null; } protected override void Setup() { // log4net //log4net.GlobalContext.Properties["Photon:ApplicationLogPath"] = Path.Combine(this.ApplicationRootPath, "log"); //var configFileInfo = new FileInfo(Path.Combine(this.BinaryPath, "log4net.config")); //if (configFileInfo.Exists) //{ // LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance); // XmlConfigurator.ConfigureAndWatch(configFileInfo); //} var file = new FileInfo(Path.Combine(BinaryPath, "log4net.config")); if (file.Exists) { LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance); XmlConfigurator.ConfigureAndWatch(file); } log.Debug("Server is ready!"); log.Info("Server is ready!"); } protected override void TearDown() { log.Debug("Server was stopped!"); log.Info("Server was stopped!"); } } }