예제 #1
0
        /// <summary>
        /// Logs the entry via datalogger - either creating a new entry or updating an existing
        /// </summary>
        /// <param name="logEntry">The log entry.</param>
        private void LogOutput(string docId, JobLogItem logEntry)
        {
            PhysicalDeviceJobLogger logger = _logData.FirstOrDefault(x => x.JobName.Contains(docId, StringComparison.OrdinalIgnoreCase));

            if (logger == null)
            {
                // Create new entry if we don't already have one
                logger = CreateDataLogItem(docId);
                if (logEntry == null)
                {
                    return;
                }
            }

            if (logger != null && logEntry != null)
            {
                // Update the existing log entry with the new information
                logger.JobApplicationName = logEntry.ApplicationName;
                logger.JobCategory        = logEntry.JobCategory;
                logger.JobEndStatus       = logEntry.JobDoneStatus;
                logger.JobEndDateTime     = Convert.ToDateTime(logEntry.JobDoneTimestamp);
                logger.JobId              = logEntry.UUID;
                logger.JobName            = logEntry.DeviceJobName;
                logger.JobStartDateTime   = Convert.ToDateTime(logEntry.JobStartedTimestamp);
                logger.MonitorEndDateTime = DateTime.Now;
                _dataLogger.Update(logger);
            }
        }
예제 #2
0
        private PhysicalDeviceJobLogger CreateDataLogItem(string docId)
        {
            var logItem = new PhysicalDeviceJobLogger()
            {
                SessionId           = _sessionId,
                DeviceId            = _deviceId,
                ActivityExecutionId = _transactionId,
                JobName             = docId,
            };

            _dataLogger.Submit(logItem);
            return(logItem);
        }
예제 #3
0
 /// <summary>
 /// If the job name wasn't found and timeout threshold was exceeded update the monitor end field for the record.
 /// </summary>
 /// <param name="docId">string</param>
 private void LogFailedOutput(string docId)
 {
     try
     {
         PhysicalDeviceJobLogger logger = _logData.FirstOrDefault(x => x.JobName.Contains(docId, StringComparison.OrdinalIgnoreCase) && !x.MonitorEndDateTime.HasValue);
         if (logger != null)
         {
             logger.MonitorEndDateTime = DateTime.Now;
             _dataLogger.Update(logger);
         }
     }
     catch (Exception)
     {
         TraceFactory.Logger.Error("Failed to mark MonitorEnd time for {0}".FormatWith(docId));
     }
 }