Esempio n. 1
0
        private string GetLogData(string sessionId)
        {
            string logFilePath;
            string pattern;

            if (GlobalSettings.IsDistributedSystem)
            {
                logFilePath = @"C:\VirtualResource\Distribution\SessionProxy\Logs";
                pattern     = "SessionProxy-{0}".FormatWith(sessionId);
            }
            else
            {
                logFilePath = LogFileReader.DataLogPath();
                pattern     = "StfWebService.exe.log";
            }

            StringBuilder builder  = new StringBuilder();
            var           logFiles = LogFileDataCollection.Create(logFilePath);

            foreach (var file in logFiles.Items.Where(x => x.FileName.StartsWith(pattern, StringComparison.OrdinalIgnoreCase)))
            {
                builder.AppendLine(file.FileData);
            }

            return(builder.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the dispatcher log data.
        /// </summary>
        /// <returns>
        /// A string buffer containing the current log data
        /// </returns>
        public string GetSessionLogFiles(string sessionId)
        {
            SetTraceSessionContext(sessionId);

            if (string.IsNullOrEmpty(sessionId))
            {
                return("Session does not exist");
            }

            string logFilePath = string.Empty;
            string pattern     = string.Empty;

            if (GlobalSettings.IsDistributedSystem)
            {
                string location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                logFilePath = Path.Combine(Path.GetDirectoryName(location), "SessionProxy", "Logs");
                //the log extension was missing previously
                pattern = "SessionProxy-{0}.log".FormatWith(sessionId);
            }
            else
            {
                logFilePath = LogFileReader.DataLogPath();
                pattern     = "STBConsole.log";
            }
            StringBuilder builder  = new StringBuilder();
            var           logFiles = LogFileDataCollection.Create(logFilePath);

            foreach (var file in logFiles.Items.Where(x => x.FileName.Equals(pattern)))
            {
                builder.AppendLine(file.FileData);
            }

            return(builder.ToString());
        }
        public static void SaveLogFiles(string location)
        {
            LogFileDataCollection logFiles = LogFileDataCollection.Create(location);

            TraceFactory.Logger.Debug($"Location={location}.  Collection Size={Math.Round(logFiles.SizeInMb, 3)} MB.");

            Run(c => c.SaveLogFiles(logFiles));
        }
Esempio n. 4
0
        /// <summary>
        /// Copies the logs.
        /// </summary>
        protected void CopyClientControllerLogs()
        {
            TraceFactory.Logger.Debug("Copying additional files from {0}".FormatWith(Machine.Name));
            LogFileDataCollection logFiles = new LogFileDataCollection();

            try
            {
                using (var clientController = ClientControllerServiceConnection.Create(Machine.Name))
                {
                    logFiles = clientController.Channel.GetLogFiles(Manifest.SessionId);
                }
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error("Unable to capture client controller log files for {0} : {1}"
                                          .FormatWith(Machine.Name, ex.ToString()));
            }

            if (GlobalSettings.IsDistributedSystem)
            {
                try
                {
                    using (var printMonitor = new WcfClient <IPrintMonitorService>(MessageTransferType.Http, WcfService.PrintMonitor.GetHttpUri(Machine.Name)))
                    {
                        logFiles.Append(printMonitor.Channel.GetLogFiles());
                    }
                }
                catch (Exception ex)
                {
                    TraceFactory.Logger.Error("Unable to capture print monitor log files for {0} : {1}"
                                              .FormatWith(Machine.Name, ex.ToString()));
                }
            }

            TraceFactory.Logger.Debug("Done: {0}".FormatWith(Machine.Name));
            MapElement.UpdateStatus("Logs copied");
            //Write to Log Directory
            logFiles.Write(LogFileReader.DataLogPath(Manifest.SessionId));
        }
Esempio n. 5
0
 /// <summary>
 /// Gets the Log Files
 /// </summary>
 /// <returns></returns>
 public LogFileDataCollection GetLogFiles()
 {
     return(LogFileDataCollection.Create(LogFileReader.DataLogPath()));
 }
 /// <summary>
 /// Gets the log files.
 /// </summary>
 /// <param name="sessionId">The session identifier.</param>
 /// <returns>LogFileDataCollection.</returns>
 public LogFileDataCollection GetCitrixLogFiles(string sessionId)
 {
     return(LogFileDataCollection.Create(LogFileReader.DataLogPath(sessionId)));
 }
Esempio n. 7
0
 /// <summary>
 /// Tells the service to copy any logs that are unique to this resource.
 /// </summary>
 public virtual LogFileDataCollection GetLogFiles(string sessionId)
 {
     return(LogFileDataCollection.Create(LogFileReader.DataLogPath()));
 }