Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Azure Streaming Log with Trace #218

Closed
YZahringer opened this issue Jul 14, 2015 · 31 comments
Closed

Azure Streaming Log with Trace #218

YZahringer opened this issue Jul 14, 2015 · 31 comments
Assignees
Labels
Investigate Investigation item
Milestone

Comments

@YZahringer
Copy link

Hello,

"System.Diagnostics.Trace.TraceInformation("Test Trace);" only write in the debug output window.

This should not write in the IIS logs? This should also work with Azure Streaming Log?

@jarroda
Copy link

jarroda commented Sep 16, 2015

Any help on this issue? I am unable to get log output to show in the Azure web app log stream.

@npnelson
Copy link

+1 on this. I can't get this to work either. I don't think it was working before beta8, but now that beta8 requires Kestrel, that might complicate the issue even more. It would be nice to get an official statement, even if the statement happens to be "we won't be supporting this anytime soon"

@muratg
Copy link

muratg commented Dec 18, 2015

@kichalla Did you recently do an investigation similar to this?

@kichalla
Copy link
Member

@muratg No. For the packagesearch website I used Serilog framework + Azure DocumentDb

@muratg
Copy link

muratg commented Dec 18, 2015

@Eilon I remember you were discussing this (logging in Azure) in another issue somewhere, but I can't seem to find it. What was the outcome?

@Eilon
Copy link
Member

Eilon commented Dec 28, 2015

Sorry I don't recall.

@muratg
Copy link

muratg commented Dec 29, 2015

@davidfowl @lodejard What are your thoughts on this? Should we recommend people to use something like Serilog or should we have an implementation that does this?

@Eilon
Copy link
Member

Eilon commented Dec 29, 2015

Would be really great to support Azure streaming logs automatically. Can we talk to an Azure person to see what we have to do to be compatible? Does it just listen to some particular output, e.g. console? Or something?

@muratg
Copy link

muratg commented Dec 29, 2015

I'll ping @davidebbo

@davidebbo
Copy link

I have an experimental project that should make that work today: https://github.com/davidebbo-test/ConsoleInterceptor. Give it a try and see how it fares.

@npnelson
Copy link

I got the consoleinterceptor to stream logs without any trouble, but I couldn't get them to upload to Blob storage by enabling Application Logging (blob) on the Azure web site. I'm not sure how the Application Log (blob) works for classic ASP.NET apps.

Perhaps a classic ASP.NET app drops the log files in a different path than the console interceptor?

It's probably user error on my part - I didn't try too hard to get it to work yet

@davidebbo
Copy link

Blob/Table storage is not supported at this point. For class .NET, it works via a registered trace listener, but that concept doesn't exist in ASP.NET 5 afaik. It's something we'll need to solve.

@muratg muratg added this to the 1.0.0-rc2 milestone Jan 12, 2016
@muratg muratg added the Investigate Investigation item label Jan 12, 2016
@qJake
Copy link

qJake commented Mar 25, 2016

Is this still an issue? I'm running ASP.NET Core 1.0 RC1, and I have tried Trace.WriteLine() and Trace.TraceXXX(), and neither are writing to the application log. I don't even see an application log when I view my log directory via FTP, and I don't see any messages when I attach to the log via azure site log tail.

Am I doing something wrong, or is this still being worked on? Not being able to trace out an issue when deployed to Azure is frustrating. 😕

@Tratcher
Copy link
Member

There was a problem where HttpPlatformHandler would not flush the logs to the stream frequently: aspnet/IISIntegration#57

We have a fix prepared for that, but we still need to get it deployed to azure and verify it.

@muratg muratg modified the milestones: 1.0.0, 1.0.0-rc2 Apr 1, 2016
@nulltoken
Copy link

Hey, @davidebbo just announced "You can now git deploy http://ASP.NET Core RC2 projects to your Azure Web Apps. #aspnetcore #azure #kudu" in https://twitter.com/davidebbo/status/733040676879929344.

Is this bug still opened or do we still have to proxy the logs through ConsoleInterceptor or such?

@muratg
Copy link

muratg commented May 19, 2016

This should be working now. If there are still issues, please file another bug.

@muratg muratg closed this as completed May 19, 2016
@davidebbo
Copy link

@muratg what's the best way to test this? Specific, what does tracing code look like in RC2? I don't think it's System.Diagnostics.Trace.TraceInformation("...");, right?

@kichalla
Copy link
Member

An example of how you can set it up: https://github.com/aspnet/Logging/blob/dev/test/Microsoft.Extensions.Logging.Test/TraceSourceLoggerTest.cs#L16-L23

and then its the usual logger.LogWarning(") etc.

@davidebbo
Copy link

I'm not seeing any log file getting created at all. My web.config has this:

<aspNetCore processPath="dotnet" arguments=".\AspNetCoreRC2.dll" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles" forwardWindowsAuthToken="false" />

What am I missing?

@muratg
Copy link

muratg commented May 19, 2016

cc @moozzyk

@moozzyk
Copy link
Contributor

moozzyk commented May 19, 2016

@davidebbo - has the application started successfully? Do you see any entries from AspNetCoreModule in the (counterpart of) eventlog? Can you share your application so that I can try it?

@davidebbo
Copy link

@moozzyk Try https://github.com/davidebbo-test/AspNetCoreRC2VS. Just git deploy it to an Azure Web App, and then edit the web.config as above.

Yes, it runs fine. It just doesn't seem to create an logs at all.

@davidebbo
Copy link

And yes, there is a startup message from core module:

<Event>
    <System>
        <Provider Name="IIS AspNetCore Module"/>
        <EventID>1001</EventID>
        <Level>0</Level>
        <Task>0</Task>
        <Keywords>Keywords</Keywords>
        <TimeCreated SystemTime="2016-05-19T23:10:11Z"/>
        <EventRecordID>11903046</EventRecordID>
        <Channel>Application</Channel>
        <Computer>RD00155DF7B4CB</Computer>
        <Security/>
    </System>
    <EventData>
        <Data>Process '4924' started successfully and is listening on port '24820'.</Data>
    </EventData>
</Event>

@davidebbo
Copy link

@moozzyk I see, the problem is that you gave the wrong info here :)

remove the stdoutLogFile attribute or set the value to ?%home%\LogFiles and set stdoutLogEnabled to true

stdoutLogFile needs can't be set to \\?\%home%\LogFiles, because that's a folder. Instead, it needs to be something like \\?\%home%\LogFiles\corelogs. Then it seems to work well enough!

@moozzyk
Copy link
Contributor

moozzyk commented May 19, 2016

@davidebbo - crap - I copied it directly from the code but it was from the code where we come up with the folder and then we append the file name to it. Apologies!

@davidebbo
Copy link

No problem, it's good that it works!

We should think about making this easier for Azure users, though, so they don't have to manually change stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout".

I'll start another issue.

@moozzyk
Copy link
Contributor

moozzyk commented May 20, 2016

You don't need to - one already exists: aspnet/IISIntegration#167

@moozzyk
Copy link
Contributor

moozzyk commented May 20, 2016

As a workaround - you can just remove the stdoutLogFile attribute entirely and publish-iis will set it correctly depending on whether you publish to Local file system or Antares (with VS)

@davidebbo
Copy link

Too late, I opened #429

@davidebbo
Copy link

@moozzyk in that case, we should change the VS template to do this. I just have whatever it generated, and so will most users.

@moozzyk
Copy link
Contributor

moozzyk commented May 20, 2016

This is one of the option we discussed but it was too late to rush anything for RC2 without risking regretting it later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Investigate Investigation item
Projects
None yet
Development

No branches or pull requests