BBjJettyContext::getLogger

Description

In BBj 17.0 and higher, this method returns a BBjspLogger which can be used to write context-specific log entries.

Syntax

Return Value

Method

BBjspLogger

getLogger()

Parameters

None.

Return Value

Returns the BBjspLogger

Remarks

None.

Example

declare BBjServletData data!
data! = BBjAPI().getServletData()

declare MyServlet myServlet!
myServlet! = new MyServlet()
data!.setCallback(data!.ON_WEB_CONNECTION, myServlet!, "myMethod")

PROCESS_EVENTS

class public MyServlet

  field private BBjNumber chan
  field private BBjHttpSession session!
  field private BBjHttpRequest request!
  field private BBjHttpResponse response!
  field private BBjJettyContext context!
  
  method public void myMethod(BBjServletEvent p_event!)
    #chan = UNT
    #request! = cast(BBjHttpRequest,p_event!.getHttpRequest())
    #session! = cast(BBjHttpSession,#request!.getSession())
    #context! = cast(BBjJettyContext,#session!.getContext())
    
    logger! = #context!,getLogger()
    logger!.log("Procssing " + #request!.getRequestURL() )
    
    #response! = p_event!.getHttpResponse()
    #response!.setContentType("text/html")
    open (#chan)"JSERVLET"
    
    print (#chan)"<html>"
    print (#chan)"<body>"
    print (#chan)"<h1>>BBj Logging Test</h1>"
    print (#chan)"</body>"
    print (#chan)"</html>"
    close (#chan)
  methodend

classend

See Also

BBjAPI

BBjServletEvent

BBjJettyContext

Logging

BBjspLogger