logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramaa Davanagere <RDAVA...@mobius.com>
Subject RE: COM and VisualBasic 6.0 and log4net
Date Fri, 02 Sep 2005 15:17:12 GMT

Thank you for responding so quickly.

After searching on internet for few days, I was able to get some help with
COM + VB6 + log4net. Actually I was quite surprised to see how easy it was
to implement log4net in VB6 applications. Things worked just perfect on the
development box but on the deployment machine, it's a different story. 

On the development box, all I did was create a simple straight forward C#
class library and reference log4net dll. The only special setting I had to
do was setting "Register for COM interop" to true in project properties.
This will create a tlb (type library) which is later referenced in the VB
application. The C# class was built with no errors. After this, I created a
standard VB Exe app and referenced log4net.tlb. My VB app contained 3 lines
of code as shown below

Dim oErr As ErrorHandler.DotNetErrHandler            
Set oErr = New ErrorHandler.DotNetErrHandler
oErr.WriteToLog_Info ("Writing a dummy info logging message here")
set oErr = nothing

and this code write the log message to the specified logfile.

However, on the deployment machine (.net framework installed), this doesn't
work atall. I get "Active X can't create object" error on line 2 above.
After doing some more research on the internet, they said, I would need to
generate a strong name for log4net and recompile log4net and that should fix
the problem. So I downloaded the sourcecode for log4net from
http://logging.apache.org/log4net/downloads.html but it just compile on my
machine. Too many reference errors and what not. I just want to do one last
try with rebuilding log4net with a strongname and see if that's helps me get
further. As you can see, I'm almost there. I really want to use log4net
because all of our newly developed products use log4net for logging and
tracing and want to NLog as a worst case scenario.  That's my long story. 

Please respond.

- Ramaa


-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Friday, September 02, 2005 10:56 AM
To: log4net-user@logging.apache.org
Subject: RE: COM and VisualBasic 6.0 and log4net

I honestly don't know if it supports it or not. I haven't used VB6+COM
in almost 4 years. I searched Google for "log4net COM" and didn't find
anything on the first page. I'm sure its possible to generate a COM
wrapper around log4net but in your post you sounded urgent for a
solution. If you've never dealt with generating COM wrappers, I think
an easier solution would be to copy the ~10 lines from the NLog website
I posted into your project and use that. While log4net tries its best
to play nice with others, its primary focus is the .NET Framework...not
interoperability with legacy VB6 applications.

If you don't need something right this second, you may want to consider
generating a COM wrapper then sharing your results with the list or
writing up something for the FAQ on the log4net website.

--- Ramaa Davanagere <RDAVANAG@mobius.com> wrote:

> 
> 
> Are you saying that log4net doesn't support COM interop API as of
> today? Do
> you know if this is in works? Also, can you tell me why log4net
> doesn't
> support COM interop? 
> 
> - Ramaa
> 
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> Sent: Friday, September 02, 2005 10:05 AM
> To: Log4NET User
> Subject: Re: COM and VisualBasic 6.0 and log4net
> 
> If you need something right away, you may want to check out NLog's
> COM
> support:
> 
>  http://nlog.sourceforge.net/comapi.html
> 
> --- Ramaa Davanagere <RDAVANAG@mobius.com> wrote:
> 
> > Has anybody been able to use log4net successfully in a Visual Basic
> > 6.0
> > application thro' COM interop? If so, please post your good. I'm in
> > desperate need of help.
> > 
> >  
> > 
> >  
> > 
> > Ramaa Davanagere
> > 
> > 
> 

Mime
View raw message