> Marcel Ruff wrote:
>
> Here is the exception thrown:
>
> 2006-12-31 19:23:40.0000 Info Adding target file:FileTarget
> 2006-12-31 19:23:40.0000 Error System.NullReferenceException:
> NullReferenceException
> bei NLog.Targets.MethodCallTarget.UpdateMethodInfo()
> bei NLog.Targets.MethodCallTarget.set_MethodName()
> bei System.Reflection.RuntimeMethodInfo.InternalInvoke()
> bei System.Reflection.RuntimeMethodInfo.InternalInvoke()
> bei System.Reflection.RuntimeMethodInfo.Invoke()
> bei System.Reflection.MethodBase.Invoke()
> bei System.Reflection.RuntimePropertyInfo.SetValue()
> bei NLog.Internal.PropertyHelper.SetPropertyFromString()
> bei NLog.Internal.PropertyHelper.ConfigureObjectFromAttributes()
> bei NLog.Config.XmlLoggingConfiguration.ConfigureTargetFromXmlElement()
> bei NLog.Config.XmlLoggingConfiguration.ConfigureTargetsFromElement()
> bei NLog.Config.XmlLoggingConfiguration.ConfigureFromXmlElement()
> bei NLog.Config.XmlLoggingConfiguration.ConfigureFromFile()
> bei NLog.Config.XmlLoggingConfiguration..ctor()
> bei NLog.Config.XmlLoggingConfiguration..ctor()
> bei NLog.LogFactory.get_Configuration()
> bei NLog.LogFactory.GetLogger()
> bei NLog.LogFactory.GetLogger()
> bei NLog.LogManager.GetLogger()
> bei siemens.vdo.MainForm..cctor()
> bei siemens.vdo.VicosLioMain.Main()
>
> 2006-12-31 19:23:40.0000 Info Adding target msgbox:MethodCallTarget
>
>
>> Hi,
>>
>> i have configured two output targets, the "File" target
>> works fine (the file grows nicely) but the second "MethodCall"
>> target is never invoked:
>>
>> ============================
>> <?xml version="1.0" ?>
>> <nlog xmlns="
http://www.nlog-project.org/schemas/NLog.xsd"
>> xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
>>
>> <targets>
>> <target name="file" xsi:type="File"
>> layout="${longdate} ${logger} ${message}"
>> fileName="${basedir}/logs/logfile.txt"
>> keepFileOpen="false"
>> encoding="iso-8859-2" />
>> <target name="msgbox" xsi:type="MethodCall"
>> className="mycompany.MainForm"
>> methodName="LogMethod">
>> <parameter layout="${level}"/>
>> <parameter layout="${message}"/>
>> </target>
>> </targets>
>>
>> <rules>
>> <logger name="*" minlevel="Debug" writeTo="file" />
>> <logger name="*" minlevel="Debug" writeTo="msgbox"/>
>> </rules>
>> </nlog>
>> ==========================
>>
>> Forcing it hard coded works fine:
>>
>> NLog.Targets.MethodCallTarget target = new
>> NLog.Targets.MethodCallTarget();
>> target.ClassName = typeof(MainForm).AssemblyQualifiedName;
>> target.MethodName = "LogMethod";
>> target.Parameters.Add(new
>> NLog.Targets.MethodCallParameter("${level}"));
>> target.Parameters.Add(new
>> NLog.Targets.MethodCallParameter("${message}"));
>> NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target,
>> LogLevel.Debug);
>>
>> but then the File target is not working anymore.
>>
>> Can you please shed some light on this?
>>
>> Thanks
>> Marcel
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys - and earn cash
>>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>> _______________________________________________
>> Nlog-list mailing list
>>
Nlog-list@...
>>
https://lists.sourceforge.net/lists/listinfo/nlog-list>>
>>
>>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> _______________________________________________
> Nlog-list mailing list
>
Nlog-list@...
>
https://lists.sourceforge.net/lists/listinfo/nlog-list>
>
Take Surveys. Earn Cash. Influence the Future of IT