Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No log output on Azure Web Site #773

Closed
simontaylor81 opened this issue Jul 26, 2015 · 5 comments
Closed

No log output on Azure Web Site #773

simontaylor81 opened this issue Jul 26, 2015 · 5 comments

Comments

@simontaylor81
Copy link

I'm testing out deploying an asp.net 5 app on Azure websites, but I'm having trouble getting any log output from the application. The azure docs say you just need to write to System.Diagnostics.Trace, but that doesn't seem to work. I tried Console.WriteLine as well for good measure, but no dice.

Steps to reproduce:

  1. Clone this repo: https://github.com/simontaylor81/AspNet5TraceTest (this is a very simple app that just writes to System.Diagnostics.Trace on every request).
  2. Deploy to Azure websites (e.g. using Visual Studio's publish option).
  3. Enable verbose application logging for the site in the Azure portal.
  4. View the application log somehow (e.g. in VS, command line, portal or kudu).
  5. Browse to the site to make a request (which should trigger the Trace call).
  6. Nothing appears in the log.

Is this something that should be working? I may be missing something in the Azure config, but I've tried pretty much everything without much success.

@Tratcher
Copy link
Member

aspnet/Logging#218

@mgolois
Copy link

mgolois commented Nov 20, 2015

Has this issue been resolved? or any work around?

@davidfowl
Copy link
Member

Trace.WriteLine won't work in azure because ASP.NET sites don't read web.config (no config hierarchy),

@DavidKarlas
Copy link
Contributor

@mgolois Workaround I'm using atm... Install Serilog.Framework.Logging NuGet package...

Add this code:

if (System.IO.Directory.Exists("D:\\home\\LogFiles\\application\\"))
{
    loggerFactory.AddSerilog(new LoggerConfiguration().WriteTo.File("D:\\home\\LogFiles\\application\\YourAppName.txt", fileSizeLimitBytes: 20 * 1024 * 1024).CreateLogger());
}

Inside public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) method.

Then you can connect with FTP client and download file... Unfortunately it's saying file used by another process(I should probably find way for Serilog to share read access...). But for now I prefer to just open Azure console and do "cp YourAppName.txt LogFileCopy.txt" and download LogFileCopy.txt...

I also noticed that Log Streaming was working... But it's not working anymore at this point(maybe since I tried to access via FTP) :(

@aspnet-hello
Copy link

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

jkotalik added a commit that referenced this issue Nov 1, 2018
ryanbrandenburg pushed a commit that referenced this issue Nov 16, 2018
natemcmaster pushed a commit that referenced this issue Nov 20, 2018
* Added support for middleware activation via IMiddlewareFactory
- IMiddlewareFactory and IMiddleware are new extensiblity points for
activating and authoring middleware. Under the covers, middleware is still
very much just a function. This just provides a nice way to get a per request
activated middleware instance that is created and released via the IMiddlewareFactory.
The caveats are that middleware needs to be registered in the container (by default)
and that not possible to explicitly pass arguments directly via UseMiddleware.
- Added tests
SteveSandersonMS pushed a commit that referenced this issue Nov 27, 2018
This doesn't seem to repro anymore after fixing #772. Adding tests
anyway.
SteveSandersonMS pushed a commit that referenced this issue Nov 27, 2018
The problem is that the new HTML rewrite pass was traversing into
attributes of all kinds and would turn any HTML content inside those
attributes into elements where possible. The solution is to not do
that.
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants