Giter Site home page Giter Site logo

nlog.mongodb's People

Contributors

dimakudr avatar lepskiy avatar mikkelfish avatar pwelter34 avatar slolife avatar stewarthou avatar thegrue avatar tkellogg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nlog.mongodb's Issues

Cannot log exceptions directly with __logger.Debug(message, Exception)

The following log line generates an error

__logger.Debug("Can I throw this exception (Debug)", new FileNotFoundException("Could not find file"));

Stack Trace

System.ArgumentException was unhandled by user code
  Message=.NET type System.IO.FileNotFoundException cannot be mapped to a BsonValue.
  Source=MongoDB.Bson
   StackTrace:
   at MongoDB.Bson.BsonTypeMapper.MapToBsonValue(Object value) in C:\build\mongo-csharp-driver\Bson\ObjectModel\BsonTypeMapper.cs:line 156
   at MongoDB.Bson.BsonValue.Create(Object value) in C:\build\mongo-csharp-driver\Bson\ObjectModel\BsonValue.cs:line 1044
   at NLog.MongoDB.BsonDocumentExtensions.AddField(BsonDocument doc, String name, Object value)
   at NLog.MongoDB.LogEventInfoExtensions.ToBsonDocument(LogEventInfo logEvent)
   at NLog.MongoDB.MongoDBTarget.BuildBsonDocument(LogEventInfo logEvent)
   at NLog.MongoDB.MongoDBTarget.Write(LogEventInfo logEvent)
   at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
  InnerException: 

Should the "exception' branch of the switch statement in AddFields() method in BsonDocumentExtensions.cs (line 17) be refactored to remove it from the switch statement and instead convert it into its own IF statement

if (unifiedName.EndsWith("exception"))
{
    doc[name] = BuildExceptionBsonDocument((Exception)value); return;
 }

Add the ability to use ConnectionStrings

It was requested on my blog to enable the logger to use connection strings. I am going to add the ability to either configure a connectionString or reference an existing one.

BSON Error

When I used nuget to pull down this package into an asp.net mvc 4 application and tried to log anything, I get this error: An Array value cannot be written to the root level of a BSON document.

The same error occurred when I created a new project too. Could you test it and see what is wrong?

public class HomeController : Controller
{
    private Logger logger = LogManager.GetCurrentClassLogger();
    public ActionResult Index()
    {
        logger.Error("test");
        return View();
    }
}

config:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <extensions>
    <add assembly="NLog.MongoDB"/>
  </extensions>

  <targets>
    <target name="Mongo" type="MongoDB" connectionString="mongodb://localhost/nlog" />
  </targets>
  <rules>
    <logger name="*" minLevel="Info" appendTo="Mongo"/>
  </rules>
</nlog>

Add a license

NLog is MIT. MongoDB C# driver is Apache 2. I wouldn't mind either of those licenses, just don't make it any form of GPL. I need a license so that my company can actually take it seriously as a library they'd consider using.

Dynamic set of fields to store

Let's say that just several fields of the large LogEventInfoData object contain useful information. So as a NLog.MongoDB consumer I would like to put into database just these valueable fields. Also I would like to be able to manage list of fields to store in NLog.config file.

<target type="MongoDB" name="Mongo-DynamicFields" connectionName="MongoDB">
  <field name="timestamp" layout="${date}" />
  <field name="level" layout="${level}" />
  <field name="message" layout="${message}" />
  <field name="exception" layout="${exception}" />
</target>

Update to mongodb driver 1.7

For now using NLog.MongoDB with 1.7 of MongoDB C# driver - impossible.

Please update version of used driver to 1.7

Nuget package out of date?

I pulled the NuGet package through VS2012 yesterday and it was not the latest version. The CollectionName field is missing, and I wasn't able to get database logging working with ConnectionName.

I downloaded and built the latest source and everything works now. Are the binaries in NuGet out of date?

Create a NuGet package

Since NLog & MongoDB C# drivers are both on NuGet, and since you're using NuGet to reference them, it would make sense if we created a NuGet package for NLog.MongoDB also.

Logging exceptions where Exception.Data has a key that contains $ or . fails.

The C# MongoDb driver correctly rejects writing MongoDb documents where field names contain '$' or '.'. As a result NLog.MongoDB fails to write log messages where an Exception's Data member has keys that contain these characters. NLog.MongoDB should replace them with something else.

See http://docs.mongodb.org/manual/core/document/ and http://docs.mongodb.org/manual/faq/developers/#faq-dollar-sign-escaping

Will submit pull request.

Nuget Package 0.4.0 doesn't include collectionName updates

Though the package followed the updates allowing a collectionName (great idea btw), it contains an earlier build of MongoTarget that uses the logger name and throws an exception if you specify a collectionName in the nlog configuration

Replace all connection details with a connetion string name

Please, consider to move all connection details (host, port..) from MongoDBTarget and replace them with a simple connection string name. This will allow to have all application connection data in a single place: connectionStrings section of config file, that means easy maintenance and simple config transformation rules.

Update mono db driver.

Hi guys.
Thank you for this tool. I have to ask you. Can you please update the driver Mongo to the latest version? In our project uses Mongo driver the last version (1.8.3), and your tool doesn't work. I cloned your project with git and updated the driver.After that all parts work is fine. How quickly can you do it? I have a ready solution and I can update repository. How quickly can you update the nuget?.
Thanks in Advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.