Hi all,
please find below a simplified version of one of my Appstart sub for a jetty-based service.
My first question is: in order to record in myappfile.txt whatever I receive in the handler, should I simply add a Log line like below?
?
As an alternative, should I activate jetty logging with level ALL? If yes, can the level be changed on the fly or does it need to stop the server/messageloop before any level change?
Sorry if the above sounds too generic. My goal is to "monitor" for some very short period of time whatever an app sends to the server in order to investigate on an apparent malfunctioning (it could be even the operator at this time..)
Thanks.
please find below a simplified version of one of my Appstart sub for a jetty-based service.
B4X:
Sub AppStart (Args() As String)
'redirect StdOut e StdErr to file
RedirectOutput(File.DirApp, "myappfile.txt")
DBstuff.InitDBStuff
srvr.Initialize("srvr")
..
srvr.StaticFilesFolder = File.Combine(File.DirApp, "www")
srvr.AddHandler("/hello", "hHello", False)
srvr.Start
StartMessageLoop
End Sub
Sub RedirectOutput (Dir As String, FileName As String)
#if RELEASE
Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) 'Set to True to append the logs
Dim ps As JavaObject
ps.InitializeNewInstance("java.io.PrintStream", Array(out, True, "utf8"))
Dim jo As JavaObject
jo.InitializeStatic("java.lang.System")
jo.RunMethod("setOut", Array(ps))
jo.RunMethod("setErr", Array(ps))
#end if
End Sub
My first question is: in order to record in myappfile.txt whatever I receive in the handler, should I simply add a Log line like below?
B4X:
Log(req.FullRequestURI)
As an alternative, should I activate jetty logging with level ALL? If yes, can the level be changed on the fly or does it need to stop the server/messageloop before any level change?
Sorry if the above sounds too generic. My goal is to "monitor" for some very short period of time whatever an app sends to the server in order to investigate on an apparent malfunctioning (it could be even the operator at this time..)
Thanks.