Fixed logging bugs

This commit is contained in:
vfedosevich 2013-06-04 18:17:12 +03:00
parent 476f7a2b19
commit e4f84fb869
3 changed files with 10 additions and 5 deletions

View file

@ -156,10 +156,15 @@ namespace WebsitePanel.EnterpriseServer
log.Severity, log.Text, log.TextIdent, BuildParametersXml(log.TextParameters)); log.Severity, log.Text, log.TextIdent, BuildParametersXml(log.TextParameters));
} }
public static List<BackgroundTaskLogRecord> GetLogs(int taskId, DateTime startLogTime) public static List<BackgroundTaskLogRecord> GetLogs(BackgroundTask task, DateTime startLogTime)
{ {
if (startLogTime <= task.StartDate)
{
startLogTime = task.StartDate;
}
List<BackgroundTaskLogRecord> logs = ObjectUtils.CreateListFromDataReader<BackgroundTaskLogRecord>( List<BackgroundTaskLogRecord> logs = ObjectUtils.CreateListFromDataReader<BackgroundTaskLogRecord>(
DataProvider.GetBackgroundTaskLogs(taskId, startLogTime)); DataProvider.GetBackgroundTaskLogs(task.Id, startLogTime));
foreach (BackgroundTaskLogRecord log in logs) foreach (BackgroundTaskLogRecord log in logs)
{ {

View file

@ -512,7 +512,7 @@ namespace WebsitePanel.EnterpriseServer
if (task == null) if (task == null)
return null; return null;
task.Logs = TaskController.GetLogs(task.Id, startLogTime); task.Logs = TaskController.GetLogs(task, startLogTime);
return task; return task;
} }
@ -600,7 +600,7 @@ namespace WebsitePanel.EnterpriseServer
private static void AddAuditLog(BackgroundTask task) private static void AddAuditLog(BackgroundTask task)
{ {
task.Logs = TaskController.GetLogs(task.Id, task.StartDate); task.Logs = TaskController.GetLogs(task, task.StartDate);
string executionLog = FormatExecutionLog(task); string executionLog = FormatExecutionLog(task);

View file

@ -51,7 +51,7 @@ namespace WebsitePanel.Portal
private void BindTask() private void BindTask()
{ {
DateTime lastLogDate = DateTime.Now.AddYears(-1); DateTime lastLogDate = DateTime.MinValue;
if (ViewState["lastLogDate"] != null) if (ViewState["lastLogDate"] != null)
lastLogDate = (DateTime)ViewState["lastLogDate"]; lastLogDate = (DateTime)ViewState["lastLogDate"];