Allow setting the stats log file location in OpenSim.ini rather than app.exe.config
parent
41d21190b1
commit
adcb1d8798
|
@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
protected OpenSimAppender m_consoleAppender;
|
||||
protected FileAppender m_logFileAppender;
|
||||
protected FileAppender m_statsLogFileAppender;
|
||||
|
||||
protected DateTime m_startuptime;
|
||||
protected string m_startupDirectory = Environment.CurrentDirectory;
|
||||
|
@ -156,6 +157,10 @@ namespace OpenSim.Framework.Servers
|
|||
{
|
||||
m_logFileAppender = (FileAppender)appender;
|
||||
}
|
||||
else if (appender.Name == "StatsLogFileAppender")
|
||||
{
|
||||
m_statsLogFileAppender = (FileAppender)appender;
|
||||
}
|
||||
}
|
||||
|
||||
if (null == m_consoleAppender)
|
||||
|
@ -185,6 +190,18 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
|
||||
}
|
||||
|
||||
if (m_statsLogFileAppender != null && startupConfig != null)
|
||||
{
|
||||
string cfgStatsFileName = startupConfig.GetString("StatsLogFile", null);
|
||||
if (cfgStatsFileName != null)
|
||||
{
|
||||
m_statsLogFileAppender.File = cfgStatsFileName;
|
||||
m_statsLogFileAppender.ActivateOptions();
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[SERVER BASE]: Stats Logging started to file {0}", m_statsLogFileAppender.File);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1190,7 +1190,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
|
||||
{
|
||||
if (appender is FileAppender)
|
||||
if (appender is FileAppender && appender.Name == "LogFileAppender")
|
||||
{
|
||||
return ((FileAppender)appender).File;
|
||||
}
|
||||
|
@ -1199,6 +1199,19 @@ namespace OpenSim.Framework
|
|||
return "./OpenSim.log";
|
||||
}
|
||||
|
||||
public static string statsLogFile()
|
||||
{
|
||||
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
|
||||
{
|
||||
if (appender is FileAppender && appender.Name == "StatsLogFileAppender")
|
||||
{
|
||||
return ((FileAppender)appender).File;
|
||||
}
|
||||
}
|
||||
|
||||
return "./OpenSimStats.log";
|
||||
}
|
||||
|
||||
public static string logDir()
|
||||
{
|
||||
return Path.GetDirectoryName(logFile());
|
||||
|
|
Loading…
Reference in New Issue