Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catching line number in exception
Message
De
11/01/2005 10:15:24
 
 
À
09/01/2005 16:33:12
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00975541
Message ID:
00976029
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Hi Michel,

I print the Exception.stacktrace which has a lot of info including the line number. In VB.Net this looks like this:
 Try
 'some stuff
 Catch ex As Exception
     Me.LogMessage(ex.Message + ex.StackTrace, EventLogEntryType.Error)
 End Try
Note: FYI LogMessage is a special function that puts the message in the windows event log I made...
    Private Sub LogMessage(ByVal Message As String, ByVal EventType As EventLogEntryType)
        'Sticks a message in the windows event 
        'log in the windows event log
        Dim WinEventLog As New EventLog

        ' Check if the the Event Log Exists
        If Not WinEventLog.SourceExists("sOliver DB2 Integration") Then
            WinEventLog.CreateEventSource("sOliver DB2 Integration", "sOliver DB2 Integration") ' Create Log
        End If
        WinEventLog.Source = "sOliver DB2 Integration"
        ' Write to the Log

        WinEventLog.WriteEntry("sOliver DB2 Integration", Message, EventType)    'EventLogEntryType.Information)
    End Sub
BR
Tim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform