AspLog 클래스

정의

애플리케이션의 로그 수신기에 이벤트 및 예외 정보를 쓰기 위한 속성 및 메서드를 제공합니다.

public ref class AspLog : Microsoft::VisualBasic::Logging::Log
public class AspLog : Microsoft.VisualBasic.Logging.Log
type AspLog = class
    inherit Log
Public Class AspLog
Inherits Log
상속
AspLog

예제

이 예제에서는 메서드를 사용하여 My.Application.Log.WriteEntry 추적 정보를 기록하는 방법을 보여줍니다. 자세한 내용은 방법: 로그 메시지 작성을 참조하세요.

Private Sub GetOpenFormTitles()
    Dim formTitles As New Collection

    Try
        For Each f As Form In My.Application.OpenForms
            ' Use a thread-safe method to get all form titles.
            formTitles.Add(GetFormTitle(f))
        Next
    Catch ex As Exception
        formTitles.Add("Error: " & ex.Message)
    End Try

    Form1.ListBox1.DataSource = formTitles
End Sub

Private Delegate Function GetFormTitleDelegate(f As Form) As String
Private Function GetFormTitle(f As Form) As String
    ' Check if the form can be accessed from the current thread.
    If Not f.InvokeRequired Then
        ' Access the form directly.
        Return f.Text
    Else
        ' Marshal to the thread that owns the form. 
        Dim del As GetFormTitleDelegate = AddressOf GetFormTitle
        Dim param As Object() = {f}
        Dim result As System.IAsyncResult = f.BeginInvoke(del, param)
        ' Give the form's thread a chance process function.
        System.Threading.Thread.Sleep(10)
        ' Check the result.
        If result.IsCompleted Then
            ' Get the function's return value.
            Return "Different thread: " & f.EndInvoke(result).ToString
        Else
            Return "Unresponsive thread"
        End If
    End If
End Function

설명

My.Application.Log 개체는 .NET Framework의 로깅 서비스에 액세스할 수 있는 간단한 진입점을 제공합니다. 및 WriteException 메서드는 WriteEntry 애플리케이션의 로그 수신기에 메시지를 씁니다. 수신기는 애플리케이션의 구성 파일로 구성할 수 있습니다. 자세한 내용은 연습: My.Application.Log에서 정보를 쓰는 위치 변경애플리케이션 로그 작업을 참조하세요.

개체는 My.Application.Log 클라이언트 애플리케이션에만 사용할 수 있습니다. 웹 애플리케이션의 My.Log경우 . 자세한 내용은 Microsoft.VisualBasic.Logging.Log를 참조하세요.

다음 표에서는 개체와 관련된 작업의 예를 나열합니다 My.Application.Log .

받는 사람 보십시오
애플리케이션의 로그 수신기에 이벤트 정보 쓰기 방법: 로그 메시지 작성
애플리케이션의 로그 수신기에 예외 정보 쓰기 방법: 예외 기록
정보를 쓰는 위치 My.Application.Log 확인 안내: My.Application.Log에서 정보를 기록하는 위치 결정

생성자

Name Description
AspLog()

AspLog 클래스의 새 인스턴스를 초기화합니다.

AspLog(String)

AspLog 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
DefaultFileLogWriter

개체의 기초가 FileLogTraceListener 되는 개체의 Log 파일을 가져옵니다.

(다음에서 상속됨 Log)
TraceSource

개체의 기초가 TraceSource 되는 개체를 Log 가져옵니다.

(다음에서 상속됨 Log)

메서드

Name Description
Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
InitializeWithDefaultsSinceNoConfigExists()

FileLogTraceListener 개체를 만들어 컬렉션에 Listeners 추가합니다.

MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
WriteEntry(String, TraceEventType, Int32)

애플리케이션의 로그 수신기에 메시지를 씁니다.

(다음에서 상속됨 Log)
WriteEntry(String, TraceEventType)

애플리케이션의 로그 수신기에 메시지를 씁니다.

(다음에서 상속됨 Log)
WriteEntry(String)

애플리케이션의 로그 수신기에 메시지를 씁니다.

(다음에서 상속됨 Log)
WriteException(Exception, TraceEventType, String, Int32)

애플리케이션의 로그 수신기에 예외 정보를 씁니다.

(다음에서 상속됨 Log)
WriteException(Exception, TraceEventType, String)

애플리케이션의 로그 수신기에 예외 정보를 씁니다.

(다음에서 상속됨 Log)
WriteException(Exception)

애플리케이션의 로그 수신기에 예외 정보를 씁니다.

(다음에서 상속됨 Log)

적용 대상

추가 정보