Compare commits

..

2 Commits

Author SHA1 Message Date
Jonathan Jenne
e71d9d7668 add basic logging for webservices 2020-09-23 10:12:20 +02:00
Jonathan Jenne
36937abe4c change config/log path to startup directory 2020-09-23 10:12:03 +02:00
2 changed files with 14 additions and 2 deletions

View File

@ -155,6 +155,8 @@ Public Class Winline
oURI &= $"?{oQuery}"
_Logger.Info("WebService Request: {0}", oURI)
Dim oRequest As HttpWebRequest = WebRequest.Create(oURI)
Dim oResponse As HttpWebResponse = DirectCast(oRequest.GetResponse(), HttpWebResponse)
Dim oXmlResponse As String
@ -163,6 +165,8 @@ Public Class Winline
oXmlResponse = oReader.ReadToEnd()
End Using
_Logger.Info("WebService Response: {0}", oXmlResponse)
Dim oDocument As New XmlDocument
oDocument.LoadXml(oXmlResponse)
oDocument.Save(Console.Out)

View File

@ -4,8 +4,16 @@
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
My.Application.LogConfig = New LogConfig(LogPath:=LogConfig.PathType.AppData, CompanyName:="Digital Data", ProductName:="WinLineProductNumberGenerator")
My.Application.ConfigManager = New ConfigManager(Of Config)(My.Application.LogConfig, Application.UserAppDataPath)
My.Application.LogConfig = New LogConfig(
LogPath:=LogConfig.PathType.CustomPath,
CustomLogPath:=Application.StartupPath,
CompanyName:="Digital Data",
ProductName:="WinLineProductNumberGenerator"
)
My.Application.ConfigManager = New ConfigManager(Of Config)(
My.Application.LogConfig,
Application.StartupPath
)
_Logger = My.Application.LogConfig.GetLogger()
Catch ex As Exception
MsgBox("Fehler beim Initialisieren (Logging und Config):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)