本文整理汇总了C#中ITracer.TraceError方法的典型用法代码示例。如果您正苦于以下问题:C# ITracer.TraceError方法的具体用法?C# ITracer.TraceError怎么用?C# ITracer.TraceError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITracer
的用法示例。
在下文中一共展示了ITracer.TraceError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTotalProcessorTime
/// <summary>
/// Calculates the sum of TotalProcessorTime for the current process and all its children.
/// </summary>
public static TimeSpan GetTotalProcessorTime(this Process process, ITracer tracer)
{
try
{
var processes = process.GetChildren().Concat(new[] { process }).Select(p => new { Name = p.ProcessName, Id = p.Id, Cpu = p.TotalProcessorTime });
var totalTime = TimeSpan.FromTicks(processes.Sum(p => p.Cpu.Ticks));
var info = String.Join("+", processes.Select(p => String.Format("{0}({1},{2:0.000}s)", p.Name, p.Id, p.Cpu.TotalSeconds)).ToArray());
tracer.Trace("Cpu: {0}=total({1:0.000}s)", info, totalTime.TotalSeconds);
return totalTime;
}
catch (Exception ex)
{
tracer.TraceError(ex);
}
return process.TotalProcessorTime;
}
示例2: Kill
public static void Kill(this Process process, bool includesChildren, ITracer tracer)
{
try
{
if (includesChildren)
{
foreach (Process child in process.GetChildren(tracer))
{
SafeKillProcess(child, tracer);
}
}
}
catch (Exception ex)
{
tracer.TraceError(ex);
}
finally
{
SafeKillProcess(process, tracer);
}
}
示例3: IsAnyInstallationRequireRestart
/// <summary>
/// <para>Scan every site extensions, check if there is any successful installation</para>
/// <para>Looking for below cases:</para>
/// <para>if not install to webroot, trigger restart; if install to webroot and with applicationHost.xdt file, trigger restart.</para>
/// </summary>
/// <param name="siteExtensionStatusRoot">should be $ROOT\site\siteextensions</param>
/// <param name="siteExtensionRoot">should be $ROOT\SiteExtensions</param>
public static bool IsAnyInstallationRequireRestart(string siteExtensionStatusRoot, string siteExtensionRoot, ITracer tracer, IAnalytics analytics)
{
try
{
using (tracer.Step("Checking if there is any installation require site restart ..."))
{
string[] packageDirs = FileSystemHelpers.GetDirectories(siteExtensionStatusRoot);
// folder name is the package id
foreach (var dir in packageDirs)
{
try
{
DirectoryInfo dirInfo = new DirectoryInfo(dir);
var statusSettings = new SiteExtensionStatus(siteExtensionStatusRoot, dirInfo.Name, tracer);
if (statusSettings.IsSiteExtensionRequireRestart(siteExtensionRoot))
{
return true;
}
}
catch (Exception ex)
{
analytics.UnexpectedException(ex, trace: false);
tracer.TraceError(ex, "Failed to query {0} under {1}, continus to check others ...", _statusSettingsFileName, dir);
}
}
}
}
catch (Exception ex)
{
analytics.UnexpectedException(ex, trace: false);
tracer.TraceError(ex, "Not able to query directory under {0}", siteExtensionStatusRoot);
}
return false;
}
示例4: Execute
public void Execute(ITracer tracer, Stream input, Stream output, string arguments, params object[] args)
{
using (GetProcessStep(tracer, arguments, args))
{
var process = CreateProcess(arguments, args);
process.Start();
var idleManager = new IdleManager(Path, IdleTimeout, tracer);
Func<StreamReader, string> reader = (StreamReader streamReader) => streamReader.ReadToEnd();
Action<Stream, Stream, bool> copyStream = (Stream from, Stream to, bool closeAfterCopy) =>
{
try
{
byte[] bytes = new byte[1024];
int read = 0;
while ((read = from.Read(bytes, 0, bytes.Length)) != 0)
{
idleManager.UpdateActivity();
to.Write(bytes, 0, read);
}
idleManager.UpdateActivity();
if (closeAfterCopy)
{
to.Close();
}
}
catch (Exception ex)
{
tracer.TraceError(ex);
}
};
IAsyncResult errorReader = reader.BeginInvoke(process.StandardError, null, null);
IAsyncResult inputResult = null;
if (input != null)
{
// Copy into the input stream, and close it to tell the exe it can process it
inputResult = copyStream.BeginInvoke(input,
process.StandardInput.BaseStream,
true,
null,
null);
}
// Copy the exe's output into the output stream
IAsyncResult outputResult = copyStream.BeginInvoke(process.StandardOutput.BaseStream,
output,
false,
null,
null);
idleManager.WaitForExit(process);
// Wait for the input operation to complete
if (inputResult != null)
{
inputResult.AsyncWaitHandle.WaitOne();
}
// Wait for the output operation to be complete
outputResult.AsyncWaitHandle.WaitOne();
string error = reader.EndInvoke(errorReader);
tracer.Trace("Process dump", new Dictionary<string, string>
{
{ "exitCode", process.ExitCode.ToString() },
{ "type", "processOutput" }
});
if (process.ExitCode != 0)
{
throw new CommandLineException(error)
{
ExitCode = process.ExitCode,
Error = error
};
}
}
}
示例5: Execute
public void Execute(ITracer tracer, Stream input, Stream output, string arguments, params object[] args)
{
using (GetProcessStep(tracer, arguments, args))
{
var process = CreateProcess(arguments, args);
Func<StreamReader, string> reader = (StreamReader streamReader) => streamReader.ReadToEnd();
Action<Stream, Stream, bool> copyStream = (Stream from, Stream to, bool closeAfterCopy) =>
{
try
{
from.CopyTo(to);
if (closeAfterCopy)
{
to.Close();
}
}
catch (Exception ex)
{
tracer.TraceError(ex);
throw;
}
};
IAsyncResult errorReader = reader.BeginInvoke(process.StandardError, null, null);
IAsyncResult inputResult = null;
if (input != null)
{
// Copy into the input stream, and close it to tell the exe it can process it
inputResult = copyStream.BeginInvoke(input,
process.StandardInput.BaseStream,
true,
null,
null);
}
// Copy the exe's output into the output stream
IAsyncResult outputResult = copyStream.BeginInvoke(process.StandardOutput.BaseStream,
output,
false,
null,
null);
process.WaitForExit();
// Wait for the input operation to complete
if (inputResult != null)
{
inputResult.AsyncWaitHandle.WaitOne();
}
// Wait for the output operation to be complete
outputResult.AsyncWaitHandle.WaitOne();
string error = reader.EndInvoke(errorReader);
tracer.Trace("Process dump", new Dictionary<string, string>
{
{ "exitCode", process.ExitCode.ToString() },
{ "type", "processOutput" }
});
if (process.ExitCode != 0)
{
throw new Exception(error);
}
}
}
示例6: Build
/// <summary>
/// Builds and deploys a particular changeset. Puts all build artifacts in a deployments/{id}
/// </summary>
private void Build(string id, ITracer tracer, IDisposable deployStep)
{
if (String.IsNullOrEmpty(id))
{
throw new ArgumentException();
}
ILogger logger = null;
DeploymentStatusFile currentStatus = null;
IDisposable buildStep = null;
try
{
logger = GetLogger(id);
ILogger innerLogger = logger.Log(Resources.Log_PreparingDeployment, TrimId(id));
currentStatus = OpenStatusFile(id);
currentStatus.Complete = false;
currentStatus.StartTime = DateTime.Now;
currentStatus.Status = DeployStatus.Building;
currentStatus.StatusText = String.Format(CultureInfo.CurrentCulture, Resources.Status_BuildingAndDeploying, id);
currentStatus.Save(_fileSystem);
ReportStatus(id);
ISiteBuilder builder = null;
try
{
builder = _builderFactory.CreateBuilder(tracer, innerLogger);
}
catch (Exception ex)
{
// If we get a TargetInvocationException, use the inner exception instead to avoid
// useless 'Exception has been thrown by the target of an invocation' messages
var targetInvocationException = ex as System.Reflection.TargetInvocationException;
if (targetInvocationException != null)
{
ex = targetInvocationException.InnerException;
}
_globalLogger.Log(ex);
tracer.TraceError(ex);
innerLogger.Log(ex);
MarkFailed(currentStatus);
ReportStatus(id);
deployStep.Dispose();
return;
}
buildStep = tracer.Step("Building");
var context = new DeploymentContext
{
ManifestWriter = GetDeploymentManifestWriter(id),
PreviousManifest = GetActiveDeploymentManifestReader(),
Tracer = tracer,
Logger = logger,
GlobalLogger = _globalLogger,
OutputPath = _environment.WebRootPath,
};
context.NextManifestFilePath = context.ManifestWriter.ManifestFilePath;
if (context.PreviousManifest != null)
{
context.PreviousManifestFilePath = context.PreviousManifest.ManifestFilePath;
}
else
{
// In this case it is the first deployment (no active deployment)
// So we remove all files from wwwroot
FileSystemHelpers.DeleteDirectoryContentsSafe(context.OutputPath);
}
builder.Build(context)
.Then(() =>
{
// End the build step
buildStep.Dispose();
// Run post deployment steps
FinishDeployment(id, tracer, deployStep);
})
.Catch(ex =>
{
// End the build step
buildStep.Dispose();
MarkFailed(currentStatus);
//.........这里部分代码省略.........
示例7: GetParentProcess
/// <summary>
/// Get parent process.
/// </summary>
public static Process GetParentProcess(this Process process, ITracer tracer)
{
IntPtr processHandle;
if (!process.TryGetProcessHandle(out processHandle))
{
return null;
}
var pbi = new ProcessNativeMethods.ProcessInformation();
try
{
int returnLength;
int status = ProcessNativeMethods.NtQueryInformationProcess(processHandle, 0, ref pbi, Marshal.SizeOf(pbi), out returnLength);
if (status != 0)
{
throw new Win32Exception(status);
}
return Process.GetProcessById(pbi.InheritedFromUniqueProcessId.ToInt32());
}
catch (Exception ex)
{
if (!process.ProcessName.Equals("w3wp", StringComparison.OrdinalIgnoreCase))
{
tracer.TraceError(ex, "GetParentProcess of {0}({1}) failed.", process.ProcessName, process.Id);
}
return null;
}
}
示例8: ExecuteProfilingCommandAsync
private static async Task<ProfileResultInfo> ExecuteProfilingCommandAsync(string arguments, ITracer tracer)
{
MemoryStream outputStream = null;
MemoryStream errorStream = null;
try
{
tracer.Step("ProcessName:" + _processName + " arguments:" + arguments);
var exe = new Executable(_processName, Path.GetDirectoryName(_processName), TimeSpan.FromSeconds(ProcessExitTimeoutInSeconds));
outputStream = new MemoryStream();
errorStream = new MemoryStream();
tracer.Step("Path:" + exe.Path + " working directory:" + exe.WorkingDirectory);
int exitCode = await exe.ExecuteAsync(tracer, arguments, outputStream, errorStream);
string output = GetString(outputStream);
string error = GetString(errorStream);
tracer.Step(output);
if (exitCode != 0)
{
tracer.TraceError(string.Format(CultureInfo.InvariantCulture, "Starting process {0} failed with the following error code '{1}'.", _processName, exitCode));
return new ProfileResultInfo(HttpStatusCode.InternalServerError, "Profiling process failed with the following error code: " + exitCode);
}
else if (!string.IsNullOrEmpty(error))
{
tracer.TraceError(error);
return new ProfileResultInfo(HttpStatusCode.InternalServerError, "Profiling process failed with the following error: " + error);
}
return new ProfileResultInfo(HttpStatusCode.OK, string.Empty);
}
catch (Exception ex)
{
tracer.TraceError(ex);
return new ProfileResultInfo(HttpStatusCode.InternalServerError, ex.Message);
}
finally
{
if (outputStream != null)
{
outputStream.Dispose();
}
if (errorStream != null)
{
errorStream.Dispose();
}
}
}
示例9: Build
/// <summary>
/// Builds and deploys a particular changeset. Puts all build artifacts in a deployments/{id}
/// </summary>
private void Build(string id, ITracer tracer, IDisposable deployStep)
{
if (String.IsNullOrEmpty(id))
{
throw new ArgumentException("The id parameter is null or empty", "id");
}
ILogger logger = null;
IDeploymentStatusFile currentStatus = null;
IDisposable buildStep = null;
try
{
logger = GetLogger(id);
ILogger innerLogger = logger.Log(Resources.Log_PreparingDeployment, TrimId(id));
currentStatus = _status.Open(id);
currentStatus.Complete = false;
currentStatus.StartTime = DateTime.Now;
currentStatus.Status = DeployStatus.Building;
currentStatus.StatusText = String.Format(CultureInfo.CurrentCulture, Resources.Status_BuildingAndDeploying, id);
currentStatus.Save();
ISiteBuilder builder = null;
try
{
builder = _builderFactory.CreateBuilder(tracer, innerLogger);
}
catch (Exception ex)
{
// If we get a TargetInvocationException, use the inner exception instead to avoid
// useless 'Exception has been thrown by the target of an invocation' messages
var targetInvocationException = ex as System.Reflection.TargetInvocationException;
if (targetInvocationException != null)
{
ex = targetInvocationException.InnerException;
}
_globalLogger.Log(ex);
tracer.TraceError(ex);
innerLogger.Log(ex);
currentStatus.MarkFailed();
deployStep.Dispose();
return;
}
buildStep = tracer.Step("Building");
var context = new DeploymentContext
{
ManifestWriter = GetDeploymentManifestWriter(id),
PreviousManifest = GetActiveDeploymentManifestReader(),
Tracer = tracer,
Logger = logger,
GlobalLogger = _globalLogger,
OutputPath = _environment.WebRootPath,
};
context.NextManifestFilePath = context.ManifestWriter.ManifestFilePath;
if (context.PreviousManifest == null)
{
// In the first deployment we want the wwwroot directory to be cleaned, we do that using a manifest file
// That has the expected content of a clean deployment (only one file: hostingstart.html)
// This will result in KuduSync cleaning this file.
context.PreviousManifest = new DeploymentManifest(Path.Combine(_environment.ScriptPath, Constants.FirstDeploymentManifestFileName));
}
context.PreviousManifestFilePath = context.PreviousManifest.ManifestFilePath;
builder.Build(context)
.Then(() =>
{
// End the build step
buildStep.Dispose();
// Run post deployment steps
FinishDeployment(id, deployStep);
})
.Catch(ex =>
{
// End the build step
buildStep.Dispose();
currentStatus.MarkFailed();
// End the deploy step
deployStep.Dispose();
return ex.Handled();
});
//.........这里部分代码省略.........
示例10: FinishDeployment
/// <summary>
/// Runs post deployment steps.
/// - Marks the active deployment
/// - Sets the complete flag
/// </summary>
private void FinishDeployment(string id, ITracer tracer, IDisposable deployStep)
{
DeploymentStatusFile currentStatus = null;
ILogger logger = null;
try
{
currentStatus = OpenStatusFile(id);
logger = GetLogger(id);
// Write the active deployment file
MarkActive(id);
logger.Log(Resources.Log_DeploymentSuccessful);
currentStatus.Status = DeployStatus.Success;
currentStatus.StatusText = String.Empty;
currentStatus.EndTime = DateTime.Now;
currentStatus.LastSuccessEndTime = currentStatus.EndTime;
currentStatus.Save(_fileSystem);
}
catch (Exception ex)
{
tracer.TraceError(ex);
MarkFailed(currentStatus);
logger.LogUnexpetedError();
}
finally
{
// Set the deployment as complete
currentStatus.Complete = true;
currentStatus.Save(_fileSystem);
ReportStatus(id);
// End the deployment step
deployStep.Dispose();
}
}
示例11: PerformDeploy
private static int PerformDeploy(
string appRoot,
string wapTargets,
string deployer,
string lockPath,
IEnvironment env,
IDeploymentSettingsManager settingsManager,
TraceLevel level,
ITracer tracer,
ITraceFactory traceFactory,
IOperationLock deploymentLock)
{
System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process);
// Skip SSL Certificate Validate
OperationClient.SkipSslValidationIfNeeded();
// Adjust repo path
env.RepositoryPath = Path.Combine(env.SiteRootPath, settingsManager.GetRepositoryPath());
string statusLockPath = Path.Combine(lockPath, Constants.StatusLockFile);
string hooksLockPath = Path.Combine(lockPath, Constants.HooksLockFile);
IOperationLock statusLock = new LockFile(statusLockPath, traceFactory);
IOperationLock hooksLock = new LockFile(hooksLockPath, traceFactory);
IBuildPropertyProvider buildPropertyProvider = new BuildPropertyProvider();
ISiteBuilderFactory builderFactory = new SiteBuilderFactory(buildPropertyProvider, env);
var logger = new ConsoleLogger();
IRepository gitRepository;
if (settingsManager.UseLibGit2SharpRepository())
{
gitRepository = new LibGit2SharpRepository(env, settingsManager, traceFactory);
}
else
{
gitRepository = new GitExeRepository(env, settingsManager, traceFactory);
}
IServerConfiguration serverConfiguration = new ServerConfiguration();
IAnalytics analytics = new Analytics(settingsManager, serverConfiguration, traceFactory);
IWebHooksManager hooksManager = new WebHooksManager(tracer, env, hooksLock);
IDeploymentStatusManager deploymentStatusManager = new DeploymentStatusManager(env, analytics, statusLock);
IAutoSwapHandler autoSwapHander = new AutoSwapHandler(env, settingsManager, traceFactory);
var functionManager = new FunctionManager(env, traceFactory);
IDeploymentManager deploymentManager = new DeploymentManager(builderFactory,
env,
traceFactory,
analytics,
settingsManager,
deploymentStatusManager,
deploymentLock,
GetLogger(env, level, logger),
hooksManager,
functionManager);
var step = tracer.Step(XmlTracer.ExecutingExternalProcessTrace, new Dictionary<string, string>
{
{ "type", "process" },
{ "path", "kudu.exe" },
{ "arguments", appRoot + " " + wapTargets }
});
using (step)
{
try
{
deploymentManager.DeployAsync(gitRepository, changeSet: null, deployer: deployer, clean: false)
.Wait();
string branch = settingsManager.GetBranch();
ChangeSet changeSet = gitRepository.GetChangeSet(branch);
IDeploymentStatusFile statusFile = deploymentStatusManager.Open(changeSet.Id);
if (statusFile != null && statusFile.Status == DeployStatus.Success)
{
autoSwapHander.HandleAutoSwap(changeSet.Id, deploymentManager.GetLogger(changeSet.Id), tracer).Wait();
}
}
catch (Exception e)
{
tracer.TraceError(e);
System.Console.Error.WriteLine(e.GetBaseException().Message);
System.Console.Error.WriteLine(Resources.Log_DeploymentError);
return 1;
}
}
if (logger.HasErrors)
{
System.Console.Error.WriteLine(Resources.Log_DeploymentError);
return 1;
}
return 0;
}
示例12: Build
/// <summary>
/// Builds and deploys a particular changeset. Puts all build artifacts in a deployments/{id}
/// </summary>
private async Task Build(string id, ITracer tracer, IDisposable deployStep, IFileFinder fileFinder)
{
if (String.IsNullOrEmpty(id))
{
throw new ArgumentException("The id parameter is null or empty", "id");
}
ILogger logger = null;
IDeploymentStatusFile currentStatus = null;
try
{
logger = GetLogger(id);
ILogger innerLogger = logger.Log(Resources.Log_PreparingDeployment, TrimId(id));
currentStatus = _status.Open(id);
currentStatus.Complete = false;
currentStatus.StartTime = DateTime.UtcNow;
currentStatus.Status = DeployStatus.Building;
currentStatus.StatusText = String.Format(CultureInfo.CurrentCulture, Resources.Status_BuildingAndDeploying, id);
currentStatus.Save();
ISiteBuilder builder = null;
string repositoryRoot = _environment.RepositoryPath;
var perDeploymentSettings = DeploymentSettingsManager.BuildPerDeploymentSettingsManager(repositoryRoot, _settings);
try
{
using (tracer.Step("Determining deployment builder"))
{
builder = _builderFactory.CreateBuilder(tracer, innerLogger, perDeploymentSettings, fileFinder);
tracer.Trace("Builder is {0}", builder.GetType().Name);
}
}
catch (Exception ex)
{
// If we get a TargetInvocationException, use the inner exception instead to avoid
// useless 'Exception has been thrown by the target of an invocation' messages
var targetInvocationException = ex as System.Reflection.TargetInvocationException;
if (targetInvocationException != null)
{
ex = targetInvocationException.InnerException;
}
_globalLogger.Log(ex);
tracer.TraceError(ex);
innerLogger.Log(ex);
currentStatus.MarkFailed();
deployStep.Dispose();
return;
}
var context = new DeploymentContext
{
NextManifestFilePath = GetDeploymentManifestPath(id),
PreviousManifestFilePath = GetActiveDeploymentManifestPath(),
Tracer = tracer,
Logger = logger,
GlobalLogger = _globalLogger,
OutputPath = GetOutputPath(_environment, perDeploymentSettings),
};
if (context.PreviousManifestFilePath == null)
{
// In the first deployment we want the wwwroot directory to be cleaned, we do that using a manifest file
// That has the expected content of a clean deployment (only one file: hostingstart.html)
// This will result in KuduSync cleaning this file.
context.PreviousManifestFilePath = Path.Combine(_environment.ScriptPath, Constants.FirstDeploymentManifestFileName);
}
using (tracer.Step("Building"))
{
try
{
await builder.Build(context);
TryTouchWebConfig(context);
// Run post deployment steps
FinishDeployment(id, deployStep);
}
catch (Exception ex)
{
tracer.TraceError(ex);
currentStatus.MarkFailed();
// End the deploy step
deployStep.Dispose();
return;
//.........这里部分代码省略.........
示例13: FailDeployment
private static void FailDeployment(ITracer tracer, IDisposable deployStep, DeploymentAnalytics deploymentAnalytics, Exception ex)
{
// End the deploy step
deployStep.Dispose();
tracer.TraceError(ex);
deploymentAnalytics.Result = "Failed";
deploymentAnalytics.Error = ex.ToString();
}
示例14: RunJobInstance
protected void RunJobInstance(JobBase job, IJobLogger logger, string runId, string trigger, ITracer tracer, int port = -1)
{
string scriptFileName = Path.GetFileName(job.ScriptFilePath);
string scriptFileFullPath = Path.Combine(WorkingDirectory, job.RunCommand);
string workingDirectoryForScript = Path.GetDirectoryName(scriptFileFullPath);
logger.LogInformation("Run script '{0}' with script host - '{1}'".FormatCurrentCulture(scriptFileName, job.ScriptHost.GetType().Name));
using (var jobStartedReporter = new JobStartedReporter(_analytics, job, trigger, Settings.GetWebSiteSku(), JobDataPath))
{
try
{
var exe = _externalCommandFactory.BuildCommandExecutable(job.ScriptHost.HostPath, workingDirectoryForScript, IdleTimeout, NullLogger.Instance);
_shutdownNotificationFilePath = RefreshShutdownNotificationFilePath(job.Name, job.JobType);
// Set environment variable to be able to identify all processes spawned for this job
exe.EnvironmentVariables[GetJobEnvironmentKey()] = "true";
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsRootPath] = WorkingDirectory;
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsName] = job.Name;
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsType] = job.JobType;
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsDataPath] = JobDataPath;
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsRunId] = runId;
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsCommandArguments] = job.CommandArguments;
if (port != -1)
{
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsPort] = port.ToString();
}
if (_shutdownNotificationFilePath != null)
{
exe.EnvironmentVariables[WellKnownEnvironmentVariables.WebJobsShutdownNotificationFile] = _shutdownNotificationFilePath;
}
UpdateStatus(logger, "Running");
int exitCode =
exe.ExecuteReturnExitCode(
tracer,
logger.LogStandardOutput,
logger.LogStandardError,
job.ScriptHost.ArgumentsFormat,
scriptFileName,
job.CommandArguments != null ? " " + job.CommandArguments : String.Empty);
if (exitCode != 0)
{
string errorMessage = "Job failed due to exit code " + exitCode;
logger.LogError(errorMessage);
jobStartedReporter.Error = errorMessage;
}
else
{
UpdateStatus(logger, "Success");
}
}
catch (ThreadAbortException ex)
{
tracer.TraceError(ex);
// We kill the process when refreshing the job
logger.LogInformation("WebJob process was aborted");
UpdateStatus(logger, "Stopped");
}
catch (Exception ex)
{
tracer.TraceError(ex);
logger.LogError(ex.ToString());
jobStartedReporter.Error = ex.Message;
}
}
}
示例15: CleanBuild
private static void CleanBuild(ITracer tracer, string buildTempPath)
{
if (buildTempPath != null)
{
using (tracer.Step("Cleaning up temp files"))
{
try
{
FileSystemHelpers.DeleteDirectorySafe(buildTempPath);
}
catch (Exception ex)
{
tracer.TraceError(ex);
}
}
}
}