logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Easlea" <matthew.eas...@cosol.com.au>
Subject COM and VB6 with Log4net?
Date Tue, 04 May 2004 00:17:03 GMT

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

<ComClass(BPC_Log4Net.ClassId, BPC_Log4Net.InterfaceId,
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

View raw message