Skip to content

Commit 6da4a75

Browse files
committed
logging in consoleapp
1 parent abade90 commit 6da4a75

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

samples/ScheduleConsoleApp/Program.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,9 @@
3636
builder.UseScheduledTasks();
3737
});
3838

39-
// Configure console logging
40-
builder.Services.AddLogging(logging =>
41-
{
42-
logging.AddSimpleConsole(options =>
43-
{
44-
options.SingleLine = true;
45-
options.UseUtcTimestamp = true;
46-
options.TimestampFormat = "yyyy-MM-ddTHH:mm:ss.fffZ ";
47-
});
48-
});
39+
// Configure logging
40+
builder.Services.AddSingleton<ILogger>(sp => sp.GetRequiredService<ILoggerFactory>().CreateLogger<Program>());
41+
builder.Services.AddLogging();
4942

5043
IHost host = builder.Build();
5144
await host.StartAsync();

0 commit comments

Comments
 (0)