How to set mine ILoggerto record to another place? I would like to write my magazines in C:\Logs\MyLogFile.log.
I configure my custom LoggerFactorylike this:
app.Properties["server.LoggerFactory"] = new MyCustomLoggerFactory();
MyCustomLoggerFactory as follows:
public class MyCustomLoggerFactory: ILoggerFactory
{
public ILogger Create(string name)
{
return new CustomLogger();
}
}
Then the interface ICustomLoggerand class CustomLoggerlook like this:
public interface ICustomLogger : ILogger
{
}
public class CustomLogger : ICustomLogger
{
public bool WriteCore(TraceEventType eventType, int eventId, object state,
Exception exception, Func<object, Exception, string> formatter)
{
throw new NotImplementedException("Dont use this one dummy");
}
}
Can't install LogLevel or Url where the log file is written? Ideally, I would also like to use log4net for this.
source
share