9

I'm trying to figure out the best way to write all of our logs as a sigle line of JSON using log4net. I want to be able to configure any appender to use it. Any help would be appreciated.

2 Answers 2

10

If you're looking for log4net JSON, see log4net.ext.json. I'm the developer. The Readme.md covers the first steps on how to get it up and running. It is used in place of a layout so it can be plugged into any log4net appender that takes a layout.

7
  • tried to use log4net.ext.json, but it doesn't work with latest log4net dll which is version 4 or above, my test program throw out binding issue so I manually changed log4net version to 1.2.10.0 then it works fine. This give me an indication that log4net.ext.json is out of date now, could someone update it so it will compatible with latest log4net?
    – Allen
    Commented Apr 17, 2015 at 2:49
  • Hi Allen, thanks for the heads-up. I prepare binaries for released versions. According to log4net website, latest release is still 1.2.13. Would you please show where you found version 4? Or do you mean .net framework version 4? Thanks, Rob Commented Apr 18, 2015 at 7:21
  • Hi Rob, yes you're right, the latest log4net.dll's version is 1.2.13.0 and runtime version is v4.0.30319. However on the auto added package.config file the version shows as 2.0.3 which gets me a bit lost. When would you think the download will be available?
    – Allen
    Commented Apr 19, 2015 at 22:49
  • Hi Allen, I'll prepare one in a few days. Know that you can use the 3.5 .net version in the meantime. Functionally, it should be the same. You'll just need to fiddle with your references somewhat. Specifically, I imagine you'll need to remove the nuget package and reference log4net and log4net.Ext.Json manually to match in .net 3.5 Commented Apr 22, 2015 at 21:07
  • 1
    I was about to roll my own client side logging handler.... Then I found log4net.ext.json on NuGet. This library is very easy to use and works great. This essentially resolved my issue which was very similar to the original question. Thanks! Commented Apr 27, 2015 at 16:35
-1

Please try this Github project which is an initiative for this

json-log4j-layout

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.