Home Forums Support NLOG Error

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #791
    Anonymous
    Inactive

    I am getting the following NLOG Error when I do
    FileTarget _target = new FileTarget();

    Error: {“LayoutRenderer cannot be found: ‘longdate'”}

    StackTrace:

    at NLog.Config.Factory`2.CreateInstance(String name) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.LayoutParser.CompileLayout(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr, Boolean isNested, String& text) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.SimpleLayout.set_Text(String value) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.SimpleLayout..ctor(String txt, ConfigurationItemFactory configurationItemFactory) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.Layout.FromString(String layoutText, ConfigurationItemFactory configurationItemFactory) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.Layout.FromString(String layoutText) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Layouts.Layout.op_Implicit(String text) in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Targets.TargetWithLayout..ctor() in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Targets.TargetWithLayoutHeaderAndFooter..ctor() in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at NLog.Targets.FileTarget..ctor() in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PriorityQueueItem.cs:line 0
    at TradeLink.Common.TLServer_IPv3..ctor(String ipaddr, Int32 port, Int32 wait, Int32 TickBufferSize, DebugDelegate deb, Boolean _delayedStart) in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay\TradeLinkCommon\TLServer_IPv3.cs:line 728
    at TradeLink.Common.TLServer_IPv3..ctor(String ipaddr, Int32 port, Int32 wait, Int32 TickBufferSize) in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay\TradeLinkCommon\TLServer_IPv3.cs:line 724
    at TradeLink.Common.TLServer_IPv3..ctor(String ipaddr, Int32 port) in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay\TradeLinkCommon\TLServer_IPv3.cs:line 716
    at _0_ShotgunTestServerForm.TradeLogic..ctor() in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay-ShotgunTestServerForm\TradeLogic.cs:line 92
    at _0_ShotgunTestServerForm.Form1..ctor() in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay-ShotgunTestServerForm\Form1.cs:line 30
    at _0_ShotgunTestServerForm.Program.Main() in C:\Users\GregJ\Documents-Code\TradeLink-20130107-RickMay-ShotgunTestServerForm\Program.cs:line 18
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

    #792
    Anonymous
    Inactive

    Heya GregJ,

    Got your comment ref the using statements. Completely agree that they should also be given in the article, I’m updating it now.

    Regarding your exception can you please tell us what platform, i.e. .net2, .net3.5, ios, …?

    Regards,
    Marc

    #794
    Anonymous
    Inactive

    I am using .net4 on windows 7.

    #795
    Anonymous
    Inactive

    This is a really strange error, we’ve never had any issues with NLOG in windows. To help debug the problem could you possibly download the source zip bundle, if you have not already, and run the ExampleConsole project (enable logging when prompted) to see if your get the same exception?

    Regards,
    Marc

    #796
    Anonymous
    Inactive

    It worked using the example project. The differences I see are that I am using
    NetworkComms within a class in a library I wrote.

    Then the main application is creating an instance of that class.

    I also notice that the ExampleConsole refrences NLOG directly, which I am not able to do from my libarary because it errors out and says the methods are available both in NLOG and NetworkComms.

    #798
    Anonymous
    Inactive

    Some questions that should find a solution:

    1. Are you enabling logging from within your object instance or the top level application?

    2. Are you referencing the merged single DLL, i.e. Core/Complete, or the individual DLLs?

    3. Can you elaborate what you mean by “I also notice that the ExampleConsole refrences NLOG directly, which I am not able to do from my libarary because it errors out and says the methods are available both in NLOG and NetworkComms.”
    Once you reference the NetworkCommsDotNetCore.dll you should be able to add namespace references to NLOG without issues?

    #799
    Anonymous
    Inactive

    I fixed it. I was referencing complete. Changed to Core and then referenced NLOG. Issue resolved.

    #800
    Anonymous
    Inactive

    Brilliant. Many thanks for the update.

    It’s worth noting that the complete DLL already contains NLOG so if you use the complete DLL you should not reference NLOG additionally.

    Regards,
    Marc

    #839
    Anonymous
    Inactive

    After some further testing I discovered this error is caused by a version bug between .Net4 and .Net4.5 assemblies. The single DLLs were built on a windows 8 machine which turns out was secretly using .Net4.5 assemblies, which then breaks if run on a machine which only has .net4. A quick fix is to use either the .net3.5 or .net2.0 build or install .net4.5 but in the long run we will find a way of ensuring this workaround is not necessary.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.