473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using log4Net in Windows Control Library

Hi,

I am using VS 2005 to build a new windows control library using vb.net. Then i am calling this library(DLL) from the ASP.Net web application. Here i want to use the log4Net DLL for writing logs. So where i have to give the configuration details and how to read from the config file.

Thanks

Manoj

Report Post
Mar 25 '09 #1
6 3573
tlhintoq
3,525 Expert 2GB
Please forgive my ignorance about log4Net. I know a lot of poeple use it, but I haven't checked it out. But I would assume the provider of Log4Net would provide instructions on how to configure/use it. Am I wrong here? Anyone around that uses it? I'm curious about how well they support it. If they don't even provide basic instructions I won't waste my time.
Mar 25 '09 #2
PRR
750 Expert 512MB
This article should be helpful... You could also use event logs..or at its simplest a text based log will do...
Mar 25 '09 #3
Hi DeepBlue,

This links which you have given is working fine when i use it in a Windows applicaion. But my scenario is as below.

1. Developed Vb.Net Windows control library.
2. Calling this DLL in a ASP.Net web application using webform's <OBJECT> tag.
3. Reading the test.dll.config file using class1.vb vb.net class. This is reading the values from <appsettings> section of the test.dll.config file.

So now i want to how to read the log4Net configuration from the Test.dll.config file.

Thanks.

Manoj
Mar 26 '09 #4
PRR
750 Expert 512MB
If i got you correctly you are saying that the assembly has its own config file? ..
if so you could
1. Put the settings of assembly in your asp.net app. web.config
2. Hard code the settings if they are not going to change...
3. If you can provide "path" you could use,
Expand|Select|Wrap|Line Numbers
  1. string path = @"C:\name.config";
  2.             string section = "appSettings";
  3.  
  4.             if (File.Exists(path))
  5.             {
  6.                 System.Configuration.ExeConfigurationFileMap map = new System.Configuration.ExeConfigurationFileMap();
  7.  
  8.                 map.ExeConfigFilename = path;
  9.  
  10.                 System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(map, System.Configuration.ConfigurationUserLevel.None);
  11.  
  12.                 AppSettingsSection appSet = (AppSettingsSection)config.GetSection("appSettings");
  13.  
  14.  
  15.  
  16.                 foreach (string str in appSet.Settings.AllKeys)
  17.                 {
  18.                     Console.WriteLine(str);
  19.                     Console.Write(appSet.Settings[str].Value);
  20.                 }
  21. }
  22.  
Mar 26 '09 #5
Hi DeepBlue,

Actually i am able to read the Test.dll.config file. But now i want to read the
log4Net configurations from the test.dll.config file.

Thanks
Manoj
Mar 26 '09 #6
PRR
750 Expert 512MB
If you go through the code i posted, you will see it does:
* Reads config file from a particular path..
If you intent to call your assembly from a web app. and you would like your assembly to read its settings from a particular file then you can use the above code as sample...
The other way is to put all your settings in web.config file...
Mar 26 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: don | last post by:
hello all, msdn says this about using a dotnet windows control library in activex environment... You have to write one relatively small piece of code to make your .NET control accessible to...
0
by: Jiml | last post by:
Hi, I have a windows control library which I reference in a web page and run within internet explorer. I would like to have a close/exit button which closes the windows control library. I've...
3
by: Engin H. | last post by:
Hi everyone, I developed a Windows Control Library Project and build an assembly named graph.dll. I add this project into an ASP.NET Web Project using "Add existing project" and then add a new...
4
by: Carl Fenley | last post by:
I believe I have almost successfully created a custom datagrid control. The new class builds without error. I have added it as reference to the main Windows Application project. It appears on...
1
by: Akif | last post by:
Hi everyone. I will try to give you as much information as i can.. any idea will be appriciated. I have Written a chat server and client program using C# programming language. Client site is...
2
by: Jeff | last post by:
I am creating an ASP.NET 2.0 application that I want to embed a Windows Control into. Here are the steps: 1) I created a new Windows Control Library with a simple "hello world" app. 2) Compiled...
5
by: Sudharsan | last post by:
Hi I have developed a Windows Control Library in VC.NET The component will play back video files and this component is used in C# applications to display multiple videos simultaneously. The...
2
by: Marek Pavlu | last post by:
Hi, I need develope control library, but can not find any examples on te internet or msdn. I can only generate project from template in VS2005, but in attempt to run after compilation, it do...
1
by: Walter Mark Worsfold | last post by:
hi, does any one know how to get a windows control library to load in firefox using either the object/emed tag? -- Regards Mark Worsfold MCP
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.