SlideShare a Scribd company logo
COMMON.LOGGING
Larry Nung
AGENDA
Introduction
Getting started
Reference
Q & A
2
INTRODUCTION
3
INTRODUCTION
 Provides a simple logging abstraction to switch
between different logging implementations.
 Support
 Log4net
 Nlog
 Microsoft Enterprise Library logging
 Microsoft Application Insights
 Microsoft Event Tracing for Windows
 Serilog
4
GETTING STARTED
5
GETTING STARTED
Install
Common.Logging
and adapter
pckage via NuGet
Register and
configure
Common.Logging
Configure adapter
log
Write log with
Common.Logging
6
INSTALL COMMON.LOGGING AND ADAPTER
PCKAGE VIA NUGET
7
INSTALL COMMON.LOGGING AND ADAPTER
PCKAGE VIA NUGET
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Common.Logging" version="3.3.1"
targetFramework="net45" />
<package id="Common.Logging.Core"
version="3.3.1" targetFramework="net45" />
<package id="Common.Logging.Log4Net1215"
version="3.3.1" targetFramework="net45" />
<package id="log4net" version="2.0.5"
targetFramework="net45" />
</packages> 8
REGISTER AND CONFIGURE
COMMON.LOGGING
<?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.Log4Net.Log4NetLoggerFactoryAdapter,
Common.Logging.Log4net1215">
<!--<arg key="configType" value="INLINE" />-->
<!--<arg key="configType" value="FILE" />-->
<arg key="configType" value="FILE-WATCH" />
<arg key="configFile" value="~/log4net.config" />
</factoryAdapter>
</logging>
</common>
</configuration>
9
CONFIGURE ADAPTER LOG
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="FullAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="LogFull.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maximumFileSize value="10MB" />
<maxSizeRollBackups value="-1" />
<CountDirection value="1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern
value="%date&#x9;[%thread]&#x9;%level&#x9;%logger&#x9;%identity&#x9;-
%message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="FullAppender" />
</root>
</log4net>
10
WRITE LOG WITH COMMON.LOGGING
using Common.Logging;
...
var logger = LogManager.GetLogger<Program>();
logger.Info("Hello World!");
...
11
REFERENCE
12
REFERENCE
 Common Infrastructure Libraries for .NET
 http://netcommon.sourceforge.net/
 net-commons/common-logging: A portable logging
abstraction for .NET
 https://github.com/net-commons/common-logging
 Xian's 學習筆記: Common.Logging
 http://blog.developer.idv.tw/2013/12/commonlogging.htm
l
13
Q&A
14
QUESTION & ANSWER
15

More Related Content

PDF
Exploiting publically exposed Version Control System
PPTX
RBAC in Swift
PDF
Linux Security for Developers
PDF
SSL Pinning and Bypasses: Android and iOS
PDF
Slides null puliya linux basics
PDF
Infrastructure Security
PPTX
hallenges of Monitoring Big Infrastructure - Icinga Camp Milan 2019
PDF
Null bhopal Sep 2016: What it Takes to Secure a Web Application
Exploiting publically exposed Version Control System
RBAC in Swift
Linux Security for Developers
SSL Pinning and Bypasses: Android and iOS
Slides null puliya linux basics
Infrastructure Security
hallenges of Monitoring Big Infrastructure - Icinga Camp Milan 2019
Null bhopal Sep 2016: What it Takes to Secure a Web Application

What's hot (16)

PPTX
Nagios-yating
PDF
HTTPS: Achievements, Challenges, and Epiphany (Web Engines Hackfest 2015)
PDF
What’s new in cas 4.2
PPTX
Pxosys Webinar Amplify your Security
PDF
Safer, More Helpful CakePHP
PDF
Web Application Firewall - Friend of your DevOps Pipeline?
PPTX
Report introduction to_npm_gulp_bower
PDF
Apereo CAS 2020 - ESUP Days #31
PDF
Applying the Unix Philosophy to Django projects: a report from the real world
PDF
Ossec Lightning
PPTX
Web Application firewall-Mod security
PPTX
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
PDF
FOSSASIA 2021 - CAS
PDF
Testing WSO2 Clusters - How It’s Done
PDF
Down by the Docker
PDF
NetJSON @ Battlemesh v9
Nagios-yating
HTTPS: Achievements, Challenges, and Epiphany (Web Engines Hackfest 2015)
What’s new in cas 4.2
Pxosys Webinar Amplify your Security
Safer, More Helpful CakePHP
Web Application Firewall - Friend of your DevOps Pipeline?
Report introduction to_npm_gulp_bower
Apereo CAS 2020 - ESUP Days #31
Applying the Unix Philosophy to Django projects: a report from the real world
Ossec Lightning
Web Application firewall-Mod security
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
FOSSASIA 2021 - CAS
Testing WSO2 Clusters - How It’s Done
Down by the Docker
NetJSON @ Battlemesh v9
Ad

Viewers also liked (20)

PPTX
Regular expression
PDF
Guías didácticas...
PPTX
PPTX
Marketing de alpina
PPTX
SikuliX
PDF
Kolby Monnig's Resume
DOCX
Diario de doble entrada
PPTX
Web deploy
PPTX
Visual studio 2017
PPTX
Topshelf - An easy service hosting framework for building Windows services us...
PPTX
Web deploy command line
PPTX
protobuf-net - Protocol Buffers library for idiomatic .NET
PPTX
PL/SQL & SQL CODING GUIDELINES – Part 4
PDF
ECoW_Leaflet_HighRes
PPTX
PL/SQL & SQL CODING GUIDELINES – Part 5
PPTX
Marketing de alpina
PPTX
Product based companies and their products
DOC
Variables Affecting Listening Comprehension in English Among Third Year High ...
PDF
erdes_nina_ffos_2015_zavrs_sveuc
PDF
Imperial College Business School - Full-Time MBA brochure
Regular expression
Guías didácticas...
Marketing de alpina
SikuliX
Kolby Monnig's Resume
Diario de doble entrada
Web deploy
Visual studio 2017
Topshelf - An easy service hosting framework for building Windows services us...
Web deploy command line
protobuf-net - Protocol Buffers library for idiomatic .NET
PL/SQL & SQL CODING GUIDELINES – Part 4
ECoW_Leaflet_HighRes
PL/SQL & SQL CODING GUIDELINES – Part 5
Marketing de alpina
Product based companies and their products
Variables Affecting Listening Comprehension in English Among Third Year High ...
erdes_nina_ffos_2015_zavrs_sveuc
Imperial College Business School - Full-Time MBA brochure
Ad

Similar to Common.logging (20)

PDF
Logs/Metrics Gathering With OpenShift EFK Stack
DOCX
Install elasticsearch, logstash and kibana
PPTX
PDF
.NET @ apache.org
PPTX
Meet Magento Spain 2019 - Our Experience with Magento Cloud
PPT
Logging Services for .net - log4net
PPTX
PDF
Neoway_N58 OpenCPU_SDK_Developer_Guide_V1.0 (1).pdf
PPTX
Logging.pptxbjjjjbhhn bhnjnnnnnnnnnnnn
PDF
CIP IT Governance 5.0 Release Notes for ArcSight Logger
PPTX
PPTX
Build, logging, and unit test tools
PDF
Erp 2.50 openbravo environment installation openbravo-wiki
PPTX
Milano Meetups #15 - Log Forwarding.pptx
PDF
0396 oracle-goldengate-12c-tutorial
PDF
Milano Meetups #15 - Log Forwarding.pptx.pdf
PPT
Logging with Logback in Scala
PPT
Slim3 quick start
Logs/Metrics Gathering With OpenShift EFK Stack
Install elasticsearch, logstash and kibana
.NET @ apache.org
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Logging Services for .net - log4net
Neoway_N58 OpenCPU_SDK_Developer_Guide_V1.0 (1).pdf
Logging.pptxbjjjjbhhn bhnjnnnnnnnnnnnn
CIP IT Governance 5.0 Release Notes for ArcSight Logger
Build, logging, and unit test tools
Erp 2.50 openbravo environment installation openbravo-wiki
Milano Meetups #15 - Log Forwarding.pptx
0396 oracle-goldengate-12c-tutorial
Milano Meetups #15 - Log Forwarding.pptx.pdf
Logging with Logback in Scala
Slim3 quick start

More from Larry Nung (20)

PPTX
Ansible - simple it automation
PPTX
sonarwhal - a linting tool for the web
PPTX
LiteDB - A .NET NoSQL Document Store in a single data file
PPTX
PL/SQL & SQL CODING GUIDELINES – Part 8
PPTX
MessagePack - An efficient binary serialization format
PPTX
PL/SQL & SQL CODING GUIDELINES – Part 7
PPTX
BenchmarkDotNet - Powerful .NET library for benchmarking
PPTX
PLSQL Coding Guidelines - Part 6
PPTX
SonarQube - The leading platform for Continuous Code Quality
PPTX
Fx.configuration
PPTX
StackExchange.redis
PPTX
Disruptor
PPTX
GRUNT - The JavaScript Task Runner
PPTX
Bower - A package manager for the web
PPTX
Generic lazy class
PPTX
PL/SQL Coding Guidelines - Part 3
PPTX
PL/SQL Coding Guidelines - Part 2
PPTX
Typescript
PPTX
Specflow
PPTX
PL/SQL Coding Guidelines - Part 1
Ansible - simple it automation
sonarwhal - a linting tool for the web
LiteDB - A .NET NoSQL Document Store in a single data file
PL/SQL & SQL CODING GUIDELINES – Part 8
MessagePack - An efficient binary serialization format
PL/SQL & SQL CODING GUIDELINES – Part 7
BenchmarkDotNet - Powerful .NET library for benchmarking
PLSQL Coding Guidelines - Part 6
SonarQube - The leading platform for Continuous Code Quality
Fx.configuration
StackExchange.redis
Disruptor
GRUNT - The JavaScript Task Runner
Bower - A package manager for the web
Generic lazy class
PL/SQL Coding Guidelines - Part 3
PL/SQL Coding Guidelines - Part 2
Typescript
Specflow
PL/SQL Coding Guidelines - Part 1

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
KodekX | Application Modernization Development
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Spectroscopy.pptx food analysis technology
PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation_ Review paper, used for researhc scholars
KodekX | Application Modernization Development
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
sap open course for s4hana steps from ECC to s4
Spectroscopy.pptx food analysis technology
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx

Common.logging

  • 4. INTRODUCTION  Provides a simple logging abstraction to switch between different logging implementations.  Support  Log4net  Nlog  Microsoft Enterprise Library logging  Microsoft Application Insights  Microsoft Event Tracing for Windows  Serilog 4
  • 6. GETTING STARTED Install Common.Logging and adapter pckage via NuGet Register and configure Common.Logging Configure adapter log Write log with Common.Logging 6
  • 7. INSTALL COMMON.LOGGING AND ADAPTER PCKAGE VIA NUGET 7
  • 8. INSTALL COMMON.LOGGING AND ADAPTER PCKAGE VIA NUGET <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Common.Logging" version="3.3.1" targetFramework="net45" /> <package id="Common.Logging.Core" version="3.3.1" targetFramework="net45" /> <package id="Common.Logging.Log4Net1215" version="3.3.1" targetFramework="net45" /> <package id="log4net" version="2.0.5" targetFramework="net45" /> </packages> 8
  • 9. REGISTER AND CONFIGURE COMMON.LOGGING <?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.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net1215"> <!--<arg key="configType" value="INLINE" />--> <!--<arg key="configType" value="FILE" />--> <arg key="configType" value="FILE-WATCH" /> <arg key="configFile" value="~/log4net.config" /> </factoryAdapter> </logging> </common> </configuration> 9
  • 10. CONFIGURE ADAPTER LOG <?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="FullAppender" type="log4net.Appender.RollingFileAppender"> <file type="log4net.Util.PatternString" value="LogFull.log" /> <appendToFile value="true" /> <rollingStyle value="Composite" /> <datePattern value="yyyyMMdd" /> <maximumFileSize value="10MB" /> <maxSizeRollBackups value="-1" /> <CountDirection value="1" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date&#x9;[%thread]&#x9;%level&#x9;%logger&#x9;%identity&#x9;- %message%newline" /> </layout> </appender> <root> <level value="INFO" /> <appender-ref ref="FullAppender" /> </root> </log4net> 10
  • 11. WRITE LOG WITH COMMON.LOGGING using Common.Logging; ... var logger = LogManager.GetLogger<Program>(); logger.Info("Hello World!"); ... 11
  • 13. REFERENCE  Common Infrastructure Libraries for .NET  http://netcommon.sourceforge.net/  net-commons/common-logging: A portable logging abstraction for .NET  https://github.com/net-commons/common-logging  Xian's 學習筆記: Common.Logging  http://blog.developer.idv.tw/2013/12/commonlogging.htm l 13