{"id":13430781,"url":"https://github.com/net-commons/common-logging","last_synced_at":"2025-03-16T06:31:34.805Z","repository":{"id":46819756,"uuid":"2134217","full_name":"net-commons/common-logging","owner":"net-commons","description":"A portable logging abstraction for .NET","archived":false,"fork":false,"pushed_at":"2021-09-23T16:10:03.000Z","size":37552,"stargazers_count":648,"open_issues_count":61,"forks_count":205,"subscribers_count":73,"default_branch":"master","last_synced_at":"2024-08-01T02:27:14.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://net-commons.github.io/common-logging","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/net-commons.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-07-31T23:10:24.000Z","updated_at":"2024-07-10T07:17:08.000Z","dependencies_parsed_at":"2022-09-23T04:51:52.930Z","dependency_job_id":null,"html_url":"https://github.com/net-commons/common-logging","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net-commons%2Fcommon-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net-commons%2Fcommon-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net-commons%2Fcommon-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net-commons%2Fcommon-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/net-commons","download_url":"https://codeload.github.com/net-commons/common-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221656437,"owners_count":16858769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T02:00:57.708Z","updated_at":"2025-03-16T06:31:34.800Z","avatar_url":"https://github.com/net-commons.png","language":"C#","funding_links":[],"categories":["Frameworks, Libraries and Tools","C#","C\\#","others","框架, 库和工具","Logging","C# #"],"sub_categories":["Logging","日志"],"readme":"# Common.Logging .NET\n\n## Project Build Status\n[![Build status](https://ci.appveyor.com/api/projects/status/nyht5oguhan7gk2c/branch/master?svg=true)](https://ci.appveyor.com/project/sbohlen/common-logging/branch/master)\n\n*Note: Build may periodically fail due to issues with the code-coverage tooling (NCover) being unable to reliably connect to the test-runner during test-runs on the CI server platform we've selected (Appveyor).  Work continues to investigate this further, but until resolved properly visitors are advised to discount failing builds reported here. \n\n## Introduction\n\nProvides a simple logging abstraction to switch between different logging implementations.\nThere is current support for log4net, NLog, Microsoft Enterprise Library logging, Microsoft Application Insights, Microsoft Event Tracing for Windows, and Serilog.\n\nAdditionally Common.Logging comes with a set of base classes making the integration of any log system a breeze.\n\nSee also\n\n* [Github Repo](http://github.com/net-commons/common-logging)\n* [Project Website](http://net-commons.github.io/common-logging)\n* [NuGet](https://www.nuget.org/packages/Common.Logging/): `Install-Package Common.Logging` \n\n## Console Quickstart\nThis demonstrates how to configure your app to log using the built in Common.Logging console adapter.\n\n### 1) Install Common.Logging via NuGet\nEither open the Package Management Console and enter the following or use the built-in GUI\n\nNuGet: `PM\u003e Install-Package Common.Logging` \n\n### 2) Register and configure Common.Logging\nThen add the relevant sections to your `app.config` or `web.config`:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003cconfiguration\u003e\n\n  \u003cconfigSections\u003e\n    \u003csectionGroup name=\"common\"\u003e\n      \u003csection name=\"logging\" type=\"Common.Logging.ConfigurationSectionHandler, Common.Logging\" /\u003e\n    \u003c/sectionGroup\u003e\n  \u003c/configSections\u003e\n\n  \u003ccommon\u003e\n    \u003clogging\u003e\n      \u003cfactoryAdapter type=\"Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging\"\u003e\n        \u003carg key=\"level\" value=\"INFO\" /\u003e\n        \u003carg key=\"showLogName\" value=\"true\" /\u003e\n        \u003carg key=\"showDateTime\" value=\"true\" /\u003e\n        \u003carg key=\"dateTimeFormat\" value=\"yyyy/MM/dd HH:mm:ss:fff\" /\u003e\n      \u003c/factoryAdapter\u003e\n    \u003c/logging\u003e\n  \u003c/common\u003e\n\n\u003c/configuration\u003e\n```\n\n## NLog Quickstart\nThere are different packages for each major NLog version. Install the correct package for your referenced NLog version. This example installs the adapter for NLog v4.1:\n\n    PM\u003e Install-Package Common.Logging.NLog41\n\nIf you are using NLog v4.0, you should install the `Common.Logging.NLog40` package and so on.  \n\nNB: Because NLog is using semver and the same strong name for every major version, Common.Logging.NLog40 and Common.Logging.NLog41 works for all NLog 4.x version. Common.Logging.NLog41 is the recommend version\n\nThe 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. \n\n```xml\n\u003ccommon\u003e\n    \u003clogging\u003e\n      \u003cfactoryAdapter type=\"Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog41\"\u003e\n    \t\u003carg key=\"configType\" value=\"INLINE\" /\u003e\n      \u003c/factoryAdapter\u003e\n    \u003c/logging\u003e\n\u003c/common\u003e\n\n\u003cnlog xmlns=\"http://www.nlog-project.org/schemas/NLog.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\u003e\n...\n\u003c/nlog\u003e\n```\n\n## Application Insights Quickstart\nThere 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:\n\n    PM\u003e Install-Package Microsoft.ApplicationInsights -Version 0.17.0\n\nThe 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.\n\n```xml\n\u003ccommon\u003e\n    \u003clogging\u003e\n      \u003cfactoryAdapter type=\"Common.Logging.ApplicationInsights.ApplicationInsightsLoggerFactoryAdapter, Common.Logging.ApplicationInsights\"\u003e\n    \t\u003carg key=\"InstrumentationKey\" value=\"[YOUR APPLICATION INSIGHTS INSTRUMENTATION KEY]\" /\u003e\n      \u003c/factoryAdapter\u003e\n    \u003c/logging\u003e\n\u003c/common\u003e\n```\n\nSee module documentation and [Source Forge](http://netcommon.sf.net/) for other factoryAdapters and their configuration values\n\n\n## Solution Layout\n\n* **bin** contains the Common.Logging distribution dll files\n* **doc** contains reference documentation.\n* **shared** contains shared nant build scripts\n* **modules** contains the sourcecode for Common.Logging.XXXX modules\n* **redist** contains redistributable assemblies like log4net for your convenience\n\nThe Common Infrastructure Libraries for .NET are released under the terms of the Apache Software License (see [license.txt](license.txt)).\n\n\n## Building\n\n* Clone the [GitHub repository](https://github.com/net-commons/common-logging) \n* Install Silverlight SDK 5\n* [Optional] Install Java for the documentation builder\n* Create a strong name key. `c:\\netcommon\u003esn -k common.net.snk`\n* Build the the solution. `c:\\netcommon\u003ebuild-release.cmd`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet-commons%2Fcommon-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnet-commons%2Fcommon-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet-commons%2Fcommon-logging/lists"}