forked from anaselhajjaji/log4net.Appender.Loki
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProgram.cs
More file actions
23 lines (18 loc) · 669 Bytes
/
Copy pathProgram.cs
File metadata and controls
23 lines (18 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
var logger = log4net.LogManager.GetLogger("Program");
var fileInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config");
if (fileInfo.Exists)
log4net.Config.XmlConfigurator.Configure(fileInfo);
else
throw new InvalidOperationException("No log config file found");
int count = 0;
while (true)
{
Thread.Sleep(2000);
logger.Debug($"Log number {count++}");
logger.Info($"Log number {count++}");
logger.Warn($"Log number {count++}");
logger.Error($"Log number {count++}");
logger.Fatal($"Log number {count++}");
}