How do I append the Instance name to a log file name?

Options
dsilvavinicius
edited July 2013 in Photon Server
I want to format my log file name as "prefix-InstanceName-Timestamp.log". Since I can get the log directory using [code2=xml]%property{Photon:UnmanagedLogDirectory}[/code2] I was wondering if I could do the same to get the Instance name. The problem is that I couldn't find any documentation about the log4net properties setup by Photon, except for the one mentioned. I want to avoid setting up the properties at runtime with C#.

Thanks!

Comments

  • Add this to your application's Setup() method:
    log4net.GlobalContext.Properties["Photon:InstanceName"] = this.PhotonInstanceName;

    In fact, the "Photon:UnmanagedLogDirectory" is the only property set up by Photon itself, and the "Photon:ApplicationLogPath" is set up in the application's that are loaded by Photon in the Setup() methods.