1

I have some legacy application in vb6 and I am interoping into .net

It all works fine in net alone but in vb6 it does not create the log. I cannot see what I am doing wrong.

I have using log4net using config file and I have added the log4net configsection into C:\Program Files\Microsoft Visual Studio\vb6.exe.config

has anybody got it working in vb6? What are the steps?

TAbdiukov
  • 1,185
  • 3
  • 12
  • 25

1 Answers1

1

vb6.exe.config could not possibly work since this is the VB 6 IDE, not your legacy application.

You would have to initialize and use log4net from the .net libraries you are interop'ing with. You can do this using XmlConfigurator and a separate config file.

Peter Lillevold
  • 33,668
  • 7
  • 97
  • 131
  • Thanks a lot for your reply. What you are saying makes total sense.It drove me mad for quite a bit till I gave up. Are you saying Create a config file call it EG "Log4net.config " In a class initialize Log4Net and use XMLCOnfigurator by pointing to the "Log4Net.Config" That sounds good. I am a total novice on log4Net and a little handle would be fantastic. I will have a look at the xmlconfigurator and whether you can pass a filename with full path to get to the config file. thanks a lot –  Oct 09 '09 at 19:38
  • @brix - yes you can. There's a sample (the console app) at the link in my answer. Good luck! (and remember to accept my answer if you found it useful ;) – Peter Lillevold Oct 09 '09 at 20:55
  • Hi, It worked thanks a lot.One final question :) how can I override the filename in the config file so that I can use Enviroment.GetFolderPath (Enviroment.SpecialFloder.CommonApplicationData) As you know different Operating system have different places the %AllUsers% in the config file does not load under ApplicationData thanks a lot again –  Oct 10 '09 at 03:33
  • @brix - great coincidence there, I answered up another question related exactly to that Check out my answer here: http://stackoverflow.com/questions/1535736/log4net-how-can-i-change-the-file-location-programmatically-c/1535998#1535998 – Peter Lillevold Oct 10 '09 at 07:43