in the Source Code NLogLogger.cs
using System;
using NLog;
namespace ServiceStack.Logging.NLogger
{
/// <summary>
/// Wrapper over the NLog 2.0 beta and above logger
/// </summary>
public class NLogLogger : ILogWithContext
{
private readonly NLog.Logger log;
public NLogLogger(string typeName)
{
log = NLog.LogManager.GetLogger(typeName, typeof(NLogLogger));
}
/// <summary>
/// Initializes a new instance of the <see cref="NLogLogger"/> class.
/// </summary>
/// <param name="type">The type.</param>
public NLogLogger(Type type)
{
log = NLog.LogManager.GetLogger(UseFullTypeNames ? type.FullName : type.Name, typeof(NLogLogger));
}
....
it will get error.
you can see the summary of the GetLogger, the secode parameter loggerType must inherit from NLog.Logger, but the class NLogLogger not inherit , so it will get error, please check it .If I removed the second paramter , it works fine.
//
// 摘要:
// Gets the specified named custom logger. Use loggerType to pass the type of the
// needed Logger.
//
// 参数:
// name:
// Name of the logger.
//
// loggerType:
// The logger class. The class must inherit from NLog.Logger.
//
// 返回结果:
// The logger of type loggerType. Multiple calls to GetLogger with the same argument
// aren't guaranteed to return the same logger reference.
//
// 备注:
// The generic way for this method is NLog.LogFactory`1.GetLogger(System.String)
[CLSCompliant(false)]
public static Logger GetLogger(string name, Type loggerType);