Reading stdout Logs for .NET Core Apps in Plesk Print

  • 0

Overview

stdout logs are essential for diagnosing .NET Core and Blazor application issues. This guide shows you how to enable, locate, and read these logs in Plesk Windows hosting.

Enabling stdout Logging

stdout logging must be enabled in your web.config file:

Step 1: Edit web.config

  1. In Plesk, go to Files
  2. Navigate to httpdocs
  3. Edit web.config

Step 2: Enable Logging

Find the aspNetCore element and update it:

<aspNetCore processPath="dotnet" 
            arguments=".YourApp.dll" 
            stdoutLogEnabled="true" 
            stdoutLogFile=".logsstdout" 
            hostingModel="inprocess">
</aspNetCore>

Step 3: Create Logs Folder

  1. In Plesk Files, navigate to httpdocs
  2. Create a new folder named logs
  3. Ensure the folder has write permissions

Locating Log Files

After enabling, logs appear in:

httpdocs/logs/stdout_YYYYMMDDHHMMSS_PID.log

Each application start creates a new log file.

Reading Logs in Plesk

  1. Go to Files in Plesk
  2. Navigate to httpdocs/logs
  3. Click on the most recent log file
  4. Click Edit in Text Editor or download the file

Understanding Log Content

stdout logs contain:

  • Startup messages - Application initialization
  • Exception details - Full stack traces
  • Configuration errors - Missing settings, connection issues
  • Request information - If logging middleware is configured

Example Log Output

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
      An error occurred using the connection to database 'mydb'.
System.Data.SqlClient.SqlException: Login failed for user 'myuser'.

Common Issues Found in Logs

Missing Dependencies

System.IO.FileNotFoundException: Could not load file or assembly 'SomePackage'

Solution: Republish with all dependencies or use self-contained deployment.

Database Connection Errors

SqlException: A network-related or instance-specific error

Solution: Verify connection string and database server accessibility.

Configuration Errors

InvalidOperationException: Unable to resolve service for type

Solution: Check dependency injection configuration in Program.cs.

Production Considerations

  • Disable stdout logging in production after debugging (stdoutLogEnabled="false")
  • Log files grow indefinitely - periodically clean old logs
  • Consider using structured logging (Serilog, NLog) for production

Alternative: Application Insights

For production monitoring, consider Azure Application Insights integration for advanced logging and diagnostics.


Was this answer helpful?

« Back