diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/GozareshgirProgramManager.Infrastructure.csproj b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/GozareshgirProgramManager.Infrastructure.csproj
index 0f441dc9..95f55437 100644
--- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/GozareshgirProgramManager.Infrastructure.csproj
+++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/GozareshgirProgramManager.Infrastructure.csproj
@@ -15,6 +15,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Services/FileManagement/LocalFileStorageService.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Services/FileManagement/LocalFileStorageService.cs
index 64c63ccc..9e534bbc 100644
--- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Services/FileManagement/LocalFileStorageService.cs
+++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Services/FileManagement/LocalFileStorageService.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
+
namespace GozareshgirProgramManager.Infrastructure.Services.FileManagement;
///
diff --git a/ServiceHost/Program.cs b/ServiceHost/Program.cs
index baa3a2f4..218871e3 100644
--- a/ServiceHost/Program.cs
+++ b/ServiceHost/Program.cs
@@ -380,23 +380,30 @@ builder.Services.AddParbad().ConfigureGateways(gateways =>
});
-// فقط Serilog برای File استفاده میشه، کنسول از لاگر پیشفرض ASP.NET استفاده میکنه
-builder.Host.UseSerilog((context, services, configuration) =>
+if (builder.Environment.IsDevelopment())
{
- var logConfig = configuration
- .ReadFrom.Configuration(context.Configuration)
- .ReadFrom.Services(services)
- .Enrich.FromLogContext();
+ builder.Host.UseSerilog((context, services, configuration) =>
+ {
+ var logConfig = configuration
+ .ReadFrom.Configuration(context.Configuration)
+ .ReadFrom.Services(services)
+ .Enrich.FromLogContext();
-
- logConfig.WriteTo.File(
- path: Path.Combine(logDirectory, "gozareshgir_log.txt"),
- rollingInterval: RollingInterval.Day,
- retainedFileCountLimit: 30,
- shared: true,
- outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"
- );
-}, writeToProviders: true); // این باعث میشه کنسول پیشفرض هم کار کنه
+
+ logConfig.WriteTo.File(
+ path: Path.Combine(logDirectory, "gozareshgir_log.txt"),
+ rollingInterval: RollingInterval.Day,
+ retainedFileCountLimit: 30,
+ shared: true,
+ outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"
+ );
+ }, writeToProviders: true); // این باعث میشه کنسول پیشفرض هم کار کنه
+
+}
+else
+{
+ builder.Host.UseSerilog();
+}
Log.Information("SERILOG STARTED SUCCESSFULLY");