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

Upgrade/net.standard.2.0 #11

Merged
merged 5 commits into from Apr 13, 2018
Merged

Upgrade/net.standard.2.0 #11

merged 5 commits into from Apr 13, 2018

Conversation

@CraigSelbert
Copy link

@CraigSelbert CraigSelbert commented Aug 29, 2017

Upgrade the code so it can work in a dot net core 2.0 application

@mostlyjason
Copy link

@mostlyjason mostlyjason commented Aug 29, 2017

@CraigSelbert thanks for your help on this! It appears that a lot of the changes are for white space. Is it possible your editor settings are different than those used by this repository?

@CraigSelbert
Copy link
Author

@CraigSelbert CraigSelbert commented Aug 30, 2017

@mostlyjason I am using VS2017 version 15.3.2 with Resharper installed and the changes are all in the csproj files. To perform this work I had to create new projects and copy the files to the new location and during that process I do have VS reformat the code files for me. I did make one change to the LoggyFormater.GetMessageAndObjectInfo to look at the rendered message and send that over if it exists. I had to do because of how I am using log4net and creating logging messages with detailed information using log4nets LoggingEvent and LoggingEventData.

On a side note I did spend some time refactoring the code, such as making public properties private readonly where applicable and various other coding style changes. I do think I will spend a few more hours cleaning up the code and would be happy for you to take a look if you are interested.

@mostlyjason
Copy link

@mostlyjason mostlyjason commented Aug 30, 2017

I think if we are going to change the editor settings we should create a .editorconfig file. I believe resharper supports editor config?

Also, I think we will have to test the code changes here to make sure they work across all versions including .NET framework 4.

@mellevsen
Copy link

@mellevsen mellevsen commented Sep 11, 2017

Eagerly awaiting this update via nuget - any word on how far away that might be?

@mostlyjason
Copy link

@mostlyjason mostlyjason commented Sep 11, 2017

@mellevsen it might be a few weeks until our team has a chance to get to this one. If you have any extra time, we would love help with the editor config or testing this pull request.

@noahwebster
Copy link

@noahwebster noahwebster commented Mar 22, 2018

Just checking to see if this will be pulled in at some point?

@Shwetajain148
Copy link

@Shwetajain148 Shwetajain148 commented Apr 5, 2018

Hi @CraigSelbert, Thanks for your PR to support .NET Core 2.0 with Loggly. I want to let you know that I am working on to test your changes/PR on my local and I came to know that you have set the target framework- netcoreapp2.0;net452 which is minimum .NET Core 2.0 and .NET Framework 4.5.2(if I am not wrong?) at- https://github.com/CraigSelbert/log4net-loggly/blob/upgrade/net.standard.2.0/source/log4net-loggly/log4net-loggly.csproj#L5.

If you see the Loggly document, you will notice that we have a support for .NET Framework 4 or higher and currently we have set the target framework to 4.0 at- https://github.com/loggly/log4net-loggly/blob/master/source/log4net-loggly/log4net-loggly.csproj#L13.

I tried adding your code reference to my .NET Framework less than 4.5.2 and .NET Core version less than 2.0 console app and it was giving me compatibility errors. May I know if there is any specific reason to increase the minimum version support? If not, then can you please look into it to have the minimum support as before i.e. NET Framework 4 and should we not support .NET Core versions 1.0 and 1.1?

Eagerly waiting for your response. Thanks!

@@ -109,7 +109,16 @@ private string GetMessageAndObjectInfo(LoggingEvent loggingEvent, out object obj
objInfo = null;
var bytesLengthAllowedToLoggly = EVENT_SIZE;

if (loggingEvent.MessageObject != null)
if (!string.IsNullOrEmpty(loggingEvent.RenderedMessage))

This comment has been minimized.

@psamit

psamit Apr 12, 2018

Is this check specific for dot net core?
If yes then we should add a comment.

This comment has been minimized.

@Shwetajain148

Shwetajain148 Apr 12, 2018

I looked into the details and found the below for LogglyEvents.MessageObject property-
"Gets the message object used to initialize this event. Note that this event may not have a valid message object. If the event is serialized the message object will not be transferred. To get the text of the message the RenderedMessage property must be used not this property." from here.

I debugged the code here and could see that each time only the first if block was getting executed because we have the value in loggingEvent.RenderedMessage. The else block to check loggingEvent.MessageObject is not required anymore so I have removed it after ensuring.

And this is not specific to dot net core, it's a common use case for old .NET Frameworks too.

@psamit
psamit approved these changes Apr 12, 2018
Copy link

@psamit psamit left a comment

LGTM

@Shwetajain148 Shwetajain148 merged commit 620eea2 into loggly:master Apr 13, 2018
@Shwetajain148
Copy link

@Shwetajain148 Shwetajain148 commented Apr 16, 2018

Hi @CraigSelbert, @mellevsen and @noahwebster, I want to let you know that I have published a nuget beta package for .NET Core 2.0 support. Can you guys please have a look on it to test this out?

You can install the beta package by following-

(a) If you are using Visual Studio 2017 IDE then run the below command on Package Manager Console-

Install-Package log4net-loggly -Version 8.0.0-beta1

OR If you are using Visual Studio Code then run the below command on terminal-

dotnet add package log4net-loggly -v 8.0.0-beta1

You can also find the detailed instructions to setup and run the .NET Core 2.0 application on GitHub README file. See- https://github.com/loggly/log4net-loggly#net-core-support

I'll wait for your feedback.

Thanks!

@CraigSelbert
Copy link
Author

@CraigSelbert CraigSelbert commented Apr 20, 2018

Thanks for this, I am sorry for not monitoring this pr, just a little busy

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

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.