Contents
Overview
ConsoleApp shows how to write a simple console application that initialises logging and logs various events.
Topics
The following classes and technologies are used by this example.
- log4net.Appender.FileAppender
- log4net.Appender.RollingFileAppender
- log4net.Appender.ConsoleAppender
- log4net.ILog
- log4net.MDC
- log4net.NDC
Languages
This example is available in the following programming languages:
- Managed C++
- C#
- Visual Basic .NET
Requirements
This example is has the following requirements:
- Microsoft .Net Framework 1.0 (1.0.3705)
- Microsoft Windows NT 4.0 or higher
Location
This example is located in the examples\net\1.0\Tutorials\ConsoleApp subdirectory of the log4net distribution.
For Example:
C:\Program Files\log4net\examples\net\1.0\Tutorials\ConsoleApp
Building the Example
In order to properly build and run this example, the following steps need to be performed.
-
Make sure that the log4net directory is in your path.
For Example:
SET PATH="%PATH%;C:\Program Files\log4net"
-
Type BUILD.cmd from the command line in the language specific subdirectory for this example.
For Example:
C:\Program Files\log4net\examples\net\1.0\Tutorials\ConsoleApp\cs> Build.cmd
Running the Example
In order to run this example, follow the instructions listed below.
-
Move to the output directory: CD bin\net\1.0\debug
-
Type ConsoleApp.exe from the command line.
For Example:
C:\Program Files\log4net\examples\net\1.0\Tutorials\ConsoleApp\cs\bin\net\1.0\debug> ConsoleApp.exe
Notes
none