Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET / NLog.Extended / Upgrade Issues #741

Closed
ghost opened this issue Jun 10, 2015 · 21 comments
Closed

ASP.NET / NLog.Extended / Upgrade Issues #741

ghost opened this issue Jun 10, 2015 · 21 comments
Milestone

Comments

@ghost
Copy link

ghost commented Jun 10, 2015

I've just upgraded from 3.2.1 to 4.0.0 on my ASP.NET WebForms project.

I am using NLog and NLog.Extended.dll. Both files have been upgraded to 4.0.0.

When I attempt to execute the website I get the following error:

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred creating the configuration section handler for nlog: Error when setting property 'Layout' on File Target[log]
Source Error:
Line 21:

This is caused by the ${aspnet-....} entries in the following line:

If I remove all of the ${aspnet-....} entries from this line the website works as before.

Prior to the upgrade everything was working fine.

If I revert back to 3.2.1 everything works again.

@304NotModified
Copy link
Member

Do you have a full error with stack trace?

Please try full clean and rebuild. We are aware that the were some. similar Net cache problems with previous releases (when upgrading)

@ghost
Copy link
Author

ghost commented Jun 10, 2015

The layout renderer have been moved to the NLog.Web library. This library has not yet been updated to NLog 4.0, but will be tomorrow, where it also will be released on nuget.

@ghost
Copy link
Author

ghost commented Jun 10, 2015

Yes I did do a full clean rebuild but it made no difference.

I found NLog.Web too and I tried it but it still failed. I could see that it was still the old version and only supported .NET 3.5.1 in the nuget packages directory.

I'll try again tomorrow when it's updated.

Will I need both NLog.Extended and NLog.Web packages in order to support ASP.NET?

On Wed, Jun 10, 2015 at 10:36 PM, Kim Christensen
notifications@github.com wrote:

The layout renderer have been moved to the NLog.Web library. This library has not yet been updated to NLog 4.0, but will be tomorrow, where it also will be released on nuget.

Reply to this email directly or view it on GitHub:
#741 (comment)

@304NotModified
Copy link
Member

Sorry for the inconvenience.

@304NotModified 304NotModified assigned ghost Jun 11, 2015
@ghost
Copy link
Author

ghost commented Jun 11, 2015

No problems. Happy to help. I can't try the update until later but can you confirm that I will need NLog.dll, NLog.Extended.dll and NLog.Web.dll now to support the aspnet variables?

@304NotModified
Copy link
Member

You don't need NLog.extended solely for NLog.web.

@304NotModified
Copy link
Member

The nuget packages had been updated (version 2.0 for the use with NLog 4.0).

So this has been resolved. If you have any problems, feel free to-open this issue, or create a new one.

@blfuentes
Copy link

I still get this error after updating to NLog 4.0 and Web 2.0
{"Error when setting property 'Layout' on File Target[f]"} when calling the GetCurrentClassLogger().

My layout is pretty simple:

    <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
        layout="${longdate} ${uppercase:${level}} :: ${aspnet-user-identity} :: ${stacktrace} ${newline} ${message}" />

Already tested if I remove the ${aspnet-user-identity} it works.

My packages.config file:
...

package id="NLog" version="4.0.0" targetFramework="net451" />
package id="NLog.Config" version="4.0.0" targetFramework="net451" />
package id="NLog.Extended" version="4.0.0" targetFramework="net451" />
package id="NLog.ManualFlush" version="2.0.0.0" targetFramework="net451" />
package id="NLog.Schema" version="4.0.0" targetFramework="net451" />
package id="NLog.Web" version="2.0.0.0" targetFramework="net451" />

...

@304NotModified
Copy link
Member

moved to NLog/NLog.Web#4

@Ekus
Copy link

Ekus commented Nov 13, 2015

After updating from NLog + NLog.Extended 3.1 to NLog + NLog.Web 4.0 I had to add

    <!--needs before targets-->
    <extensions>
    <add assembly="NLog.Web"/>
    </extensions>

before my targets section. Can it be fixed so we don't need it in the future? It was able to use .Extended assembly without this trick before.

@304NotModified
Copy link
Member

What are the new versions of each component?

Because this is all fixed a long time ago.

@Ekus
Copy link

Ekus commented Nov 13, 2015

I just used VS 2013's NuGet which provides the latest version by default. I typed "nlog web" and I only see one version, 4.0.0 Creaded by NLog, Id: NLog.Web, published 10/22/1015. It also included NLog 4.0.0 as dependency (which seems to explaint it since I saw mention of it being fixed in 4.0.1..?)
image

@Ekus
Copy link

Ekus commented Nov 13, 2015

Additionally, the reference says "runtime 2.0" for that NLog.Web version... while for NLog (also 4.0.0) it says runtime 4.0
image

@304NotModified
Copy link
Member

I recommend to upgrade NLog to the latest version. (4.2.0). Thinks are fixed in 4.0.1 but also 4.1.

NLog.web is compatible with all version of NLog 4.0+

All other NLog extensions should be 4.0+

The <extensions> is not needed anymore.

@304NotModified
Copy link
Member

Additionally, the reference says "runtime 2.0" for that NLog.Web version... while for NLog (also 4.0.0) it says runtime 4.0

That's correct. There is not special build for NLog.Web for .Net 4 (not needed, no benefit). It's .Net3.5+ (which is runtime 2.0)

@Ekus
Copy link

Ekus commented Nov 13, 2015

I see, it makes sense now but it's confusing. Shouldn't just the NLog.Web nuget be updated then? To require 4.0.1+ NLog as dependency? Or else it will keep resurfacing

@Ekus
Copy link

Ekus commented Nov 13, 2015

The best thing about NLog is how simple to use it is, but I have recently had hard time spreading it among colleagues, with the breaking changes in 4.0 (move from .Extended to .Web) and this bugged autoload version being installed by default on new boxes. In any case thanks for maintaining this great tool!

@304NotModified
Copy link
Member

Well, NLog 4.0 works well with NLog.Web 4.0, but it's not optimal.

When upgrading, it's good practice to upgrade all components to have the optimal experience. With the command line it's really easy:

Install-Package NLog.Web; Install-Package NLog;

Blame Nuget for the annoying dependency resolution, which is really bad. (it takes always the lowest version)

We can upgrade NLog.Web to 4.2.0, but no code is changed in that component, so we think it's bad practice.

@Ekus
Copy link

Ekus commented Nov 13, 2015

Yes I agree it should not be required and that the blame is on nuget's side (albeit they must have their reasons and they bring more good than harm anyway ;-) ) but the simplest pragmatic solution would be to either update the NLog.Web package (not sure if you can update package definition without changing its version) or to recompile it with new version and create new package to match.

@304NotModified
Copy link
Member

@Ekus went everything fine with upgrading?

@Ekus
Copy link

Ekus commented Dec 13, 2015

Oh, yes, once I installed the newest NLog first, instead of relying on NLog.Web adding NLog 4.0 as a dependency. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants