B4J Question How to disable jetty debug info please ?

basicall

Member
Licensed User
Longtime User
Hi,

The following information always displayed no matter in debug version of release version of my b4j project:

2015-12-17 11:09:13.546:INFO::main: Logging initialized @656ms
2015-12-17 11:09:13.718:INFO:eek:ejs.Server:main: jetty-9.1.z-SNAPSHOT
2015-12-17 11:09:13.765:WARN:eek:ejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale zh_CN
2015-12-17 11:09:13.812:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@b8daa7{/,file:/D:/B4J/noui_ws_std/Objects/www/,AVAILABLE}
2015-12-17 11:09:13.812:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened D:\B4J\noui_ws_std\Objects\logs\b4j-2015_12_17.request.log
2015-12-17 11:09:13.843:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@be0f51{HTTP/1.1}{0.0.0.0:8848}
2015-12-17 11:09:13.843:INFO:eek:ejs.Server:main: Started @984ms


Could we disable the above log info ?

Regards

Davi
 

basicall

Member
Licensed User
Longtime User
Anyway I recommend give us a choice by adding a property such as enableLog to Jserver. To show log info we just need to set jserver.enablelog=true otherwise set it to false.
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

see example Sub. But as Erel stated, be careful turning off. It requires the JavaObject library.

B4X:
'Set Jetty Logging Level
'Parameter: Level. Possible values: ALL|DEBUG|INFO|WARN|OFF
'See: http://download.eclipse.org/jetty/9.3.6.v20151106/apidocs/org/eclipse/jetty/util/log/StdErrLog.html
'Note: Be aware that logging contains important info. Default is INFO
'Example:
'Sub AppStart (Args() As String)
'    SetLoggingLevel("OFF")
'    srvr.Initialize("srvr")
Sub SetLoggingLevel(level As String)
    Log("Set Logging Level to " & level.ToUpperCase)
    If level.Length = 0 Then Return
    Dim joJ As JavaObject    'Jetty Object
    Dim joP As JavaObject    'Properties Object
    joP.InitializeNewInstance("java.util.Properties", Null)
    joP.RunMethod("setProperty", Array("org.eclipse.jetty.LEVEL", level.ToUpperCase))
    joJ.InitializeNewInstance("org.eclipse.jetty.util.log.StdErrLog", Array("JettyLog", joP))
End Sub
 
Upvote 0

basicall

Member
Licensed User
Longtime User
Hi,

see example Sub. But as Erel stated, be careful turning off. It requires the JavaObject library.

B4X:
'Set Jetty Logging Level
'Parameter: Level. Possible values: ALL|DEBUG|INFO|WARN|OFF
'See: http://download.eclipse.org/jetty/9.3.6.v20151106/apidocs/org/eclipse/jetty/util/log/StdErrLog.html
'Note: Be aware that logging contains important info. Default is INFO
'Example:
'Sub AppStart (Args() As String)
'    SetLoggingLevel("OFF")
'    srvr.Initialize("srvr")
Sub SetLoggingLevel(level As String)
    Log("Set Logging Level to " & level.ToUpperCase)
    If level.Length = 0 Then Return
    Dim joJ As JavaObject    'Jetty Object
    Dim joP As JavaObject    'Properties Object
    joP.InitializeNewInstance("java.util.Properties", Null)
    joP.RunMethod("setProperty", Array("org.eclipse.jetty.LEVEL", level.ToUpperCase))
    joJ.InitializeNewInstance("org.eclipse.jetty.util.log.StdErrLog", Array("JettyLog", joP))
End Sub


Thanks rwblinn. I have just tested your code. It could work properly.
 
Upvote 0
Top