注册 登录
编程论坛 VB.NET论坛

vb生成log日志

zh2208 发布于 2008-03-20 11:27, 1804 次点击
如何在vb中生成log日志
2 回复
#2
fairy42008-03-20 11:46
Public Function writeText(ByVal str As String) '
        Try
            str &= ControlChars.CrLf
            Dim fStream As FileStream
            Dim sFileName As String
            sFileName = Application.StartupPath & "\login.log"

            fStream = New FileStream(sFileName, FileMode.Append)
            Dim bWrite() As Byte = System.Text.Encoding.Default.GetBytes(str)
            fStream.Write(bWrite, 0, bWrite.Length)
            fStream.Flush()
            fStream.Close()
            fStream = Nothing
        Catch ex As Exception
        End Try
    End Function
這個就可以寫日誌了!
#3
zh22082008-03-21 17:31
vb中是否有专用log日志的包,或者方法??
1