logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohit s <rohits_...@yahoo.co.in>
Subject RE: COM and VB6 with Log4net?
Date Fri, 28 May 2004 04:26:23 GMT
now a days we r trying to make a logging service based on log4Net which used by various application
( VB/VC++/.NET app)...
but could not even after using COM Interop. Our code works fine ( no comilation  and runtime
error) but Logging is not happening.. We dont know the reason.
But i come across your post and like your idea. Can you post your code so that we can used
it in our application..
Thanks in advance

Matthew Easlea <matthew.easlea@cosol.com.au> wrote:
Hi everybody,

Last time I posted this message nobody seemed to reply. I am about to go
live with the solution as it appears to be working well during our testing
and I was wondering if anybody had any final comments, reasons why I
shouldn't use Log4Net from VB6? 

I've made some small improvements to the code below and will post if anybody
is interested.


-----Original Message-----
From: Matthew Easlea [mailto:matthew.easlea@cosol.com.au] 
Sent: Tuesday, 4 May 2004 10:17 AM
To: log4net-user@logging.apache.org
Subject: COM and VB6 with Log4net?


I have the situation where I 70% of my components are written in .NET, but
quite few large legacy components are hanging around in VB6.

I would like to consolidate my logging framework, and as all the vb6
components use the same custom built logging class, I would like to change
the vb6 logging class to use Log4NET.

Has anybody used Log4Net from old COM based languages? I have a basic system
working, I had to write a COM based wrapper class library in .NET - such as
in the code below - but if the log4net community has a default or properly
written and tested interface I would much rather use that. Any plans on
including such an interface in a future version of log4net? Also I have the
obvious problem of missing stack traces, line numbers etc. I think this
would be a much sought after feature that would be really good for many
large companies that are slowly migrating to .NET.


Following code has been copied from a class library in Visual Studio 2003.

Imports System
Imports System.IO
Imports log4net
Imports log4net.Config

BPC_Log4Net.EventsId)> _
Public Class BPC_Log4Net

#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class 
' and its COM interfaces. If you change them, existing 
' clients will no longer be able to access the class.
Public Const ClassId As String = "EF01DF44-C835-411A-8F33-A3BC048E69AD"
Public Const InterfaceId As String =
Public Const EventsId As String = "7FD05B38-36B7-425C-B850-9BB05BFC1D2B"
#End Region

Private ReadOnly log As log4net.ILog = LogManager.GetLogger("COSOL")

Public Sub LogMessage(ByVal MessageIn As String, ByVal MessageType As
End Sub

' A creatable COM class must have a Public Sub New() 
' with no parameters, otherwise, the class will not be 
' registered in the COM registry and cannot be created 
' via CreateObject.
Public Sub New()
Dim path As String = " log4netConfig.xml"
Dim fi As FileInfo = New FileInfo(path)

End Sub

End Class

Yahoo! India Matrimony: Find your partner online.
View raw message