blob: 9e0875b99c44a6af167d7f7b373219923bb13933 [file] [log] [blame]
using System;
using System.IO;
using System.Reflection;
using NLog;
using NLog.Config;
namespace org.apache.rocketmq
{
public class MqLogManager
{
public static LogFactory Instance
{
get { return LazyInstance.Value; }
}
private static readonly Lazy<LogFactory> LazyInstance = new(BuildLogFactory);
private static LogFactory BuildLogFactory()
{
// Use name of current assembly to construct NLog config filename
Assembly thisAssembly = Assembly.GetExecutingAssembly();
Console.WriteLine(thisAssembly.Location);
string configFilePath = Path.ChangeExtension(thisAssembly.Location, ".nlog");
LogFactory logFactory = new LogFactory();
logFactory.Configuration = new XmlLoggingConfiguration(configFilePath, logFactory);
return logFactory;
}
}
}