diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs index 38f87a2067..bed91d9666 100644 --- a/OpenSim/Addons/Groups/Service/GroupsService.cs +++ b/OpenSim/Addons/Groups/Service/GroupsService.cs @@ -850,7 +850,7 @@ namespace OpenSim.Groups return false; } - if (!add && data == null) // it dosn't exist, can't update + if (!add && data == null) // it doesn't exist, can't update { m_log.DebugFormat("[Groups]: Group {0} doesn't exist. Can't update it", groupID); return false; diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 73f0323874..ba32f5008e 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -46,6 +46,7 @@ namespace OpenSim.Framework.Console private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_historyPath; private bool m_historyEnable; + private bool m_historytimestamps; // private readonly object m_syncRoot = new object(); private const string LOGLEVEL_NONE = "(none)"; @@ -98,15 +99,30 @@ namespace OpenSim.Framework.Console string m_historyFile = startupConfig.GetString("ConsoleHistoryFile", "OpenSimConsoleHistory.txt"); int m_historySize = startupConfig.GetInt("ConsoleHistoryFileLines", 100); m_historyPath = Path.GetFullPath(Path.Combine(Util.configDir(), m_historyFile)); - m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1}", m_historySize, m_historyPath); + m_historytimestamps = startupConfig.GetBoolean("ConsoleHistoryTimeStamp", false); + m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1} {2} timestamps", + m_historySize, m_historyPath, m_historytimestamps?"with":"without"); if (File.Exists(m_historyPath)) { + List originallines = new List(); using (StreamReader history_file = new StreamReader(m_historyPath)) { string line; while ((line = history_file.ReadLine()) != null) { + originallines.Add(line); + if(line.StartsWith("[")) + { + int indx = line.IndexOf("]:> "); + if(indx > 0) + { + if(indx + 4 >= line.Length) + line = String.Empty; + else + line = line.Substring(indx + 4); + } + } m_history.Add(line); } } @@ -114,11 +130,14 @@ namespace OpenSim.Framework.Console if (m_history.Count > m_historySize) { while (m_history.Count > m_historySize) + { m_history.RemoveAt(0); + originallines.RemoveAt(0); + } using (StreamWriter history_file = new StreamWriter(m_historyPath)) { - foreach (string line in m_history) + foreach (string line in originallines) { history_file.WriteLine(line); } @@ -141,6 +160,8 @@ namespace OpenSim.Framework.Console m_history.Add(text); if (m_historyEnable) { + if (m_historytimestamps) + text = String.Format("[{0} {1}]:> {2}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), text); File.AppendAllText(m_historyPath, text + Environment.NewLine); } }