Skip to content

Log errors to the global error log when they occur during building. #89

Merged
merged 3 commits into from Apr 17, 2012

2 participants

@davidfowl
projectkudu member
  • Don't duplicate output for msbuild and npm install.
  • Added assertions to function tests.
@davidfowl davidfowl Log errors to the global error log when they occur during building.
- Don't duplicate output for msbuild and npm install.
- Added assertions to function tests.
e140acf
@davidebbo davidebbo was assigned Apr 17, 2012
@davidebbo
projectkudu member

I never noticed output was duplicated.

@davidfowl
projectkudu member

It wasn't, and this change doesn't introduce that (which it would if I were to blindly log all errors).

@davidebbo davidebbo and 1 other commented on an outdated diff Apr 17, 2012
Kudu.Core/Deployment/BasicBuilder.cs
@@ -67,6 +69,11 @@ public Task Build(DeploymentContext context)
{
context.Tracer.TraceError(ex);
+ // HACK: Log an empty error to the global logger (post receive hook console output).
+ // The reason we don't log the real exception is because the 'live output' when downloding
+ // npm packages has already been captured.
+ context.GlobalLogger.Log(String.Empty, LogEntryType.Error);
+
@davidebbo
projectkudu member
davidebbo added a note Apr 17, 2012

But didn't we run into cases where npm was dying without outputting anything? Or is that a separate issue not yet addressed?

@davidebbo
projectkudu member
davidebbo added a note Apr 17, 2012

Also, what's not clear from the comment is what exactly does this add to the log. Obviously, you wouldn't do it if it had no effect :)

@davidfowl
projectkudu member
davidfowl added a note Apr 17, 2012

The npm issue is addressed. The output you saw was the error stream which was correct. This change makes the "Error occured" show up in the console.

It's a little hacky (hence the HACK:) since we write live output directly to the console and the GlobalLogger is also attached to console. So I need to Log an error here so that the code in kudu.exe knows that there was an overall error (Since this exception doesn't make it's way up to the exe),

@davidfowl
projectkudu member
davidfowl added a note Apr 17, 2012

This is a hacky way of doing something like MarkDeploymentAsFailed().

@davidebbo
projectkudu member
davidebbo added a note Apr 17, 2012

Ah I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@davidebbo davidebbo and 1 other commented on an outdated diff Apr 17, 2012
Kudu.Core/Deployment/DeploymentContext.cs
@@ -8,6 +8,7 @@ public class DeploymentContext
public IDeploymentManifestWriter ManifestWriter { get; set; }
public ITracer Tracer { get; set; }
public ILogger Logger { get; set; }
+ public ILogger GlobalLogger { get; set; }
@davidebbo
projectkudu member
davidebbo added a note Apr 17, 2012

Basic comments about the semantic of these 3 things would be nice. It's pretty confusing when you don't know the code well.

@davidfowl
projectkudu member
davidfowl added a note Apr 17, 2012

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@davidfowl davidfowl merged commit 58bc7b4 into master Apr 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.