Coder Social home page Coder Social logo

zenima / common-logging Goto Github PK

View Code? Open in Web Editor NEW

This project forked from net-commons/common-logging

0.0 1.0 0.0 27.16 MB

A portable logging abstraction for .NET

Home Page: http://netcommon.sourceforge.net/

License: Apache License 2.0

Batchfile 0.24% C# 99.73% Visual Basic 0.03%

common-logging's Introduction

Common.Logging .NET

Project Build Status

Build status

Introduction

Provides a simple logging abstraction to switch between different logging implementations. There is current support for log4net, NLog and Enterprise Library logging.

Additionally Common.Logging comes with a set of base classes making the integration of any log system a breeze.

See also

Console Quickstart

This demonstrates how to configure your app to log using the built in Common.Logging console adapter.

1) Install Common.Logging via NuGet

Either open the Package Management Console and enter the following or use the built-in GUI

NuGet: PM> Install-Package Common.Logging

2) Register and configure Common.Logging

Then add the relevant sections to your app.config or web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
        <arg key="level" value="INFO" />
        <arg key="showLogName" value="true" />
        <arg key="showDateTime" value="true" />
        <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
      </factoryAdapter>
    </logging>
  </common>

</configuration>

NLog Quickstart

There are different packages for each major NLog version. Install the correct package for your referenced NLog version. This example installs the adapter for NLog v2.0:

PM> Install-Package Common.Logging.NLog20

If you are using NLog v3.0, you should install the Common.Logging.NLog30 package and so on.

The app config should then have a common logging section like below. Be sure to match the factoryAdapter type with your installed Common.Logging.NLogXX version.

<common>
    <logging>
      <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
    	<arg key="configType" value="INLINE" />
      </factoryAdapter>
    </logging>
</common>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</nlog>

Application Insights Quickstart

There are different packages for each major Application Insights version. Install the correct package for your referenced Application Insights version. This example installs the adapter for Application Insights v0.17:

PM> Install-Package Microsoft.ApplicationInsights -Version 0.17.0

The app config should then have an Application Insights section like below. Be sure to set the InstrumentationKey with your InstrumentationKey retrieved from Application Insights portal https://portal.azure.com.

<common>
    <logging>
      <factoryAdapter type="Common.Logging.ApplicationInsights.ApplicationInsightsLoggerFactoryAdapter, Common.Logging.ApplicationInsights">
    	<arg key="InstrumentationKey" value="[YOUR APPLICATION INSIGHTS INSTRUMENTATION KEY]" />
      </factoryAdapter>
    </logging>
</common>

See module documentation and Source Forge for other factoryAdapters and their configuration values

Solution Layout

  • bin contains the Common.Logging distribution dll files
  • doc contains reference documentation.
  • shared contains shared nant build scripts
  • modules contains the sourcecode for Common.Logging.XXXX modules
  • redist contains redistributable assemblies like log4net for your convenience

The Common Infrastructure Libraries for .NET are released under the terms of the Apache Software License (see license.txt).

Building

  • Clone the GitHub repository
  • Install Silverlight SDK 5
  • [Optional] Install Java for the documenation builder
  • Create a strong name key. c:\netcommon>sn -k common.net.snk
  • Build the the solution. c:\netcommon>build-release.cmd

common-logging's People

Contributors

304notmodified avatar adamralph avatar adrianhopebailie avatar arithmomaniac avatar aseovic avatar bbaia avatar bradwilson avatar cd21h avatar daniel-svensson avatar dennis-gr avatar eeichinger avatar froggiefrog avatar giorgistoynev avatar ioancrisan avatar joelbourbon avatar keichinger avatar meixger avatar mihailsm avatar sbohlen avatar serra avatar tdupont750 avatar wied03 avatar

Watchers

 avatar

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.