Click here to Skip to main content
15,883,870 members
Articles / Web Development / ASP.NET

The Pipe Design and Log4Net

Rate me:
Please Sign up or sign in to vote.
1.62/5 (11 votes)
15 Jan 2004CPOL2 min read 85K   22   17
From Designer's view to see the Pipe Architecture and apply with Log4Net
Image 1

Introduction

The goal of this article is not to show "how to", but from my point of view, one of the reasons why Log4Net looks this way.

After reading this, you could decide to build your own logging engine or to easily use this interesting Framework.

Background You Need

  • An idea about object-oriented programming
  • (Optional) Experience of Log4Net/Log4Net

The Log4Net

You could get this from http://log4net.sourceforge.net/. It's an application framework, focus on the most common event logging service. It's from Java Group. and it's open source. Microsoft has the same Application Framework, try to do this too. It is called "Enterprise Instrumentation Framework (EIF)". When you build a house of application, in addition to the classical tiers solutions, there are some building blocks that can just fit in with any one of those.

For example, the security and the Management as below:

Image 2

The Abstraction

Image the "sewage treatment". Everyone's house must has pipes, which at the end will be connected into one big "sewage factory". If you ever play the EA's game "SimCity™ 4" you should already know what I am talking about. So, what's interesting? From the above diagram, I had used fish and cancer to explain.

Component: It's your house.

Logger: It's the Pipe with controllable gate door.

Appender: It's the place your pipe will connect to the exact "sewage factory"

Filter: During the flow of pipe, you put kinds of Filter to allow only interesting subjects flow through.

Layout: Once you have got your interesting subject, you need to pack it into Repository Recognizable format.

Render: Finally, you have to physically translate it into the Repository.

We could also think of this in the CRC's way.

Image 3

The Dynamic View

Our first diagram is another type of collaboration diagram. We could see this in sequence.

Image 4

Inside the Logger object, when we push event into that Logger, some calculation would look like this:

Image 5

Writing Motivation and Other Notes

This article is from my point of design view, and I have to say that the trigger for me to write this paper is Log4Net.

It doesn't means that I have read all the papers from them, or I have traced all the source code.

In fact, I had only read their document of Introduction from page 1 to 6, and I want to keep my mind in a creative mode, so I wrote this.

It means, in the real Log4Net project, it sure has more detail or events have a totally different design from what I had imagined.

Since it's a nice hint for me, and that's open source, here I am.

History

  • 2003/1/16 First made, please comment
  • 2003/1/17 Added "The Context" session
  • 2003/1/19 Refined the article's structure and content

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Taiwan Taiwan
Major in Object Oriented and Software Engineering.

btw, I am from Taiwan.


Comments and Discussions

 
GeneralMultiple Processes Pin
Anonymous21-Jul-04 19:46
Anonymous21-Jul-04 19:46 
GeneralRe: Multiple Processes Pin
Polo Lee23-Jul-04 18:15
Polo Lee23-Jul-04 18:15 
Generalgood article Pin
Kodanda Pani18-Apr-04 23:59
Kodanda Pani18-Apr-04 23:59 
GeneralThe Article Explained Pin
Dave Cantrell21-Jan-04 4:10
Dave Cantrell21-Jan-04 4:10 
GeneralRe: The Article Explained Pin
Anonymous2-Feb-04 7:50
Anonymous2-Feb-04 7:50 
GeneralGOOD JOB! Pin
YCBL17-Jan-04 3:12
YCBL17-Jan-04 3:12 
GeneralRe: GOOD JOB! Pin
Anonymous17-Jan-04 16:42
Anonymous17-Jan-04 16:42 
GeneralRe: GOOD JOB! Pin
Polo Lee18-Jan-04 14:22
Polo Lee18-Jan-04 14:22 
GeneralRe: GOOD JOB! Pin
Anonymous19-Jan-04 8:10
Anonymous19-Jan-04 8:10 
GeneralRe: GOOD JOB! Pin
Polo Lee19-Jan-04 22:40
Polo Lee19-Jan-04 22:40 
QuestionWow, Ohh, Hmmm??? Pin
Anonymous16-Jan-04 7:48
Anonymous16-Jan-04 7:48 
AnswerRe: Wow, Ohh, Hmmm??? Pin
Polo Lee18-Jan-04 14:32
Polo Lee18-Jan-04 14:32 
GeneralRe: Wow, Ohh, Hmmm??? Pin
Anonymous19-Jan-04 8:05
Anonymous19-Jan-04 8:05 
GeneralRe: Wow, Ohh, Hmmm??? Pin
Polo Lee19-Jan-04 22:49
Polo Lee19-Jan-04 22:49 
GeneralForget Rose or VisualUML Pin
Orcrist20-Jan-04 10:06
Orcrist20-Jan-04 10:06 
GeneralPlease improve this article Pin
Tom Welch16-Jan-04 3:41
Tom Welch16-Jan-04 3:41 
GeneralRe: Please improve this article Pin
Polo Lee16-Jan-04 14:47
Polo Lee16-Jan-04 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.