views:

202

answers:

1

Hi 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?

thanks a lot

A: 

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
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
brix
@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
Hi,It worked thanks a lot.One final question :)how can I override the filename in the config file so that I can useEnviroment.GetFolderPath(Enviroment.SpecialFloder.CommonApplicationData)As you know different Operating system have different places the %AllUsers% in the config file does not load under ApplicationDatathanks a lot again
brix
@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