How do you enable Log4Net logging?

Doug Wolanick
edited May 2010 in Photon Server
In the server code, I see log messages like:
log.Debug("Received OperationRequest. Code: " + operationRequest.OperationCode);

But I don't see them being output into any files.

There is a log4net.config file, which seems to be in the folders of each game type (Lite, liteLobby, MmoSample).

LiteLobbyApplication.cs for example has the following:
log4net.Config.XmlConfigurator.Configure(new FileInfo("bin\\log4net.config"));

So in the folder where I run PhotonControl.exe from, I added a bin folder and put the log4net.config in it. I now get a log file a few folders up, but it doesn't contain nice log messages, just strange ones.

Perhaps I am missing something. I am building in debug mode.

I do see the following log files:

But those contain nothing useful for server side logic.


  • the applications have their log in in the deploy/log folder, every application an own one
  • I do see that log file in /deploy/log for my custom application, but it doesn't contain the log information I would expect.

    It actually only contains:
    2010-05-15 23:51:28,795 [1] INFO  Photon.SocketServer.Application [(null)] - Application start. AppId: AppId=BeGoneServer; AppPath=C:\Code\ProtonStudio\FPSOnline\BeGoneServer\deploy\BeGoneServer\BeGoneServer

    In my applications log4net.config I even tried changing the following:
    <!-- operation data logger -->
      <!-- set level to DEBUG to enable operation data logging-->
      <logger name="OperationData" additivity="false">
        <level value="INFO" />
        <appender-ref ref="LogFileAppender" />

    I changed INFO to DEBUG. But it only added some new OperationData entries with hex codes for the data. Not the useful log messages like "Received OperationRequest. Code:".
  • I got it, had to just change the following:
    <!-- logger -->
        <level value="DEBUG" />
        <appender-ref ref="LogFileAppender" /> 
        <appender-ref ref="ConsoleAppender" />
  • glad you got it solved :)
  • Im trying to activate debugging too, but i don´t know what config file should I modify. The config file in Lite directory?
  • The config file in Lite directory?