Open Closed

Logging on Azure WebApp which uses Packed zip Deploy #1428


User avatar
0
learnabp created

I have deployed our app to Azure WebApp and are using DevOps pipelines to deploy using packaged deploy method using zp file

Seems when we do this ABP is unable to write the log to "Logs/logs.txt" becuase the wwwroot dir is set to read only by design

            Log.Logger = new LoggerConfiguration()
#if DEBUG
                .MinimumLevel.Debug()
#else
                .MinimumLevel.Information()
#endif
                .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
                .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
                .Enrich.FromLogContext()
                .WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
                .WriteTo.Async(c => c.Console())
#endif
                .CreateLogger();

what is the best way to write logs on azure?


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Current directory is not wwwroot.

    May be you can try .WriteTo.Async(c => c.File("logs.txt"))

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11