Photon 4.0 PhotonServer.config 和 log4net.config 新建项目配置文件

1.PhotonServer.config 中加入自己新建服务器项目的配置文件

加在 Configuration标签下面,和另外两个默认项目标签同一等级

    <MyPhotonServer
        MaxMessageSize="512000"
        MaxQueuedDataPerPeer="512000"
        PerPeerMaxReliableDataInTransit="51200"
        PerPeerTransmitRateLimitKBSec="256"
        PerPeerTransmitRatePeriodMilliseconds="200"
        MinimumTimeout="5000"
        MaximumTimeout="30000"
        DisplayName="MyPhotonServer">
    <!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
    <!-- Port 5055 is Photon's default for UDP connections. -->
    <UDPListeners>
      <UDPListener
                IPAddress="0.0.0.0"
                Port="5055"
                OverrideApplication="MyPhotonServer">
      </UDPListener>
    </UDPListeners>
    <!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
    <TCPListeners>
      <!-- TCP listener for Game clients on Master application -->
      <TCPListener
                IPAddress="0.0.0.0"
                Port="4530"
                OverrideApplication="MyPhotonServer"
                PolicyFile="Policy\assets\socket-policy.xml"
                InactivityTimeout="10000"
                >
      </TCPListener>
      <!-- DON'T EDIT THIS. TCP listener for GameServers on Master application -->
      <TCPListener
                IPAddress="0.0.0.0"
                Port="4520">
      </TCPListener>
    </TCPListeners>
    <!-- Policy request listener for Unity and Flash (port 843) and Silverlight (port 943)  -->
    <PolicyFileListeners>
      <!-- multiple Listeners allowed for different ports -->
      <PolicyFileListener
            IPAddress="0.0.0.0"
            Port="843"
            PolicyFile="Policy\assets\socket-policy.xml">
      </PolicyFileListener>
      <PolicyFileListener
            IPAddress="0.0.0.0"
            Port="943"
            PolicyFile="Policy\assets\socket-policy-silverlight.xml">
      </PolicyFileListener>
    </PolicyFileListeners>
    <!-- Defines the Photon Runtime Assembly to use. -->
    <Runtime
            Assembly="PhotonHostRuntime, Culture=neutral"
            Type="PhotonHostRuntime.PhotonDomainManager"
            UnhandledExceptionPolicy="Ignore">
    </Runtime>
    <!-- Defines which applications are loaded on start and which of them is used by default. Make sure the default application is defined. -->
    <!-- Application-folders must be located in the same folder as the bin_win32 folders. The BaseDirectory must include a "bin" folder. -->
    <Applications Default="MyPhotonServer">
      <Application
                Name="MyPhotonServer"
                BaseDirectory="MyPhotonServer"
                Assembly="MyPhotonServer"
                Type="MyPhotonServer.MyPhotonServerApplication"
                ForceAutoRestart="true"
                WatchFiles="dll;config"
                ExcludeFiles="log4net.config">
            </Application>    

      <!-- CounterPublisher Application -->
      <Application
                Name="CounterPublisher"
                BaseDirectory="CounterPublisher"
                Assembly="CounterPublisher"
                Type="Photon.CounterPublisher.Application"
                ForceAutoRestart="true"
                WatchFiles="dll;config"
                ExcludeFiles="log4net.config">
      </Application>
    </Applications>
  </MyPhotonServer>


2.log4net.config 简单配置文件


<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="false">
  <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %-30.30c{2} %m% [%t]%n" />
    </layout>
  </appender>

    <!-- "normal" log file appender -->
    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">    
        <file type="log4net.Util.PatternString" value="%property{Photon:ApplicationLogPath}\\%property{LogFileName}.log" />
    <encoding value="utf-8" />
    <param name="AppendToFile" value="true" />
        <param name="MaxSizeRollBackups" value="1" />
        <param name="MaximumFileSize" value="250MB" />
        <param name="RollingStyle" value="Size" />
    <param name="LockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
        </layout>
    </appender>
  <!-- logger -->
  <root>
    <level value="ALL" />
    <appender-ref ref="LogFileAppender" />
    <!--<appender-ref ref="ConsoleAppender" />-->
    </root>
  <logger name="OperationData">
    <level value="INFO" />
  </logger>

</log4net>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值