aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDan Lake2013-02-06 16:42:55 -0800
committerDan Lake2013-02-06 16:44:59 -0800
commitdf37738ce7702774c4d3ff1f3835bfe87e0f1a5e (patch)
tree67293c7ed7345837caccdbd880770be3f680a475 /OpenSim
parentBulletSim: remove degenerate triangles from meshes. This fixes the (diff)
downloadopensim-SC_OLD-df37738ce7702774c4d3ff1f3835bfe87e0f1a5e.zip
opensim-SC_OLD-df37738ce7702774c4d3ff1f3835bfe87e0f1a5e.tar.gz
opensim-SC_OLD-df37738ce7702774c4d3ff1f3835bfe87e0f1a5e.tar.bz2
opensim-SC_OLD-df37738ce7702774c4d3ff1f3835bfe87e0f1a5e.tar.xz
WebStats will now use actual logfile as specified in OpenSim.exe.config rather than hardcoded ./OpenSim.log. This allows for rotating logs and other file appender types
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Util.cs16
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs2
2 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 9b1e97d..d9148fb 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,6 +45,7 @@ using System.Text.RegularExpressions;
45using System.Xml; 45using System.Xml;
46using System.Threading; 46using System.Threading;
47using log4net; 47using log4net;
48using log4net.Appender;
48using Nini.Config; 49using Nini.Config;
49using Nwc.XmlRpc; 50using Nwc.XmlRpc;
50using OpenMetaverse; 51using OpenMetaverse;
@@ -816,9 +817,22 @@ namespace OpenSim.Framework
816 return "."; 817 return ".";
817 } 818 }
818 819
820 public static string logFile()
821 {
822 foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
823 {
824 if (appender is FileAppender)
825 {
826 return ((FileAppender)appender).File;
827 }
828 }
829
830 return "./OpenSim.log";
831 }
832
819 public static string logDir() 833 public static string logDir()
820 { 834 {
821 return "."; 835 return Path.GetDirectoryName(logFile());
822 } 836 }
823 837
824 // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html 838 // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 438ef48..b98b762 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -420,7 +420,7 @@ namespace OpenSim.Region.UserStatistics
420 Encoding encoding = Encoding.ASCII; 420 Encoding encoding = Encoding.ASCII;
421 int sizeOfChar = encoding.GetByteCount("\n"); 421 int sizeOfChar = encoding.GetByteCount("\n");
422 byte[] buffer = encoding.GetBytes("\n"); 422 byte[] buffer = encoding.GetBytes("\n");
423 string logfile = Util.logDir() + "/" + "OpenSim.log"; 423 string logfile = Util.logFile();
424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
425 Int64 tokenCount = 0; 425 Int64 tokenCount = 0;
426 Int64 endPosition = fs.Length / sizeOfChar; 426 Int64 endPosition = fs.Length / sizeOfChar;