Salesforce

How to flush the PASOE extended deferred logging to disk using OE Manager's REST API?

« Go Back

Information

 
TitleHow to flush the PASOE extended deferred logging to disk using OE Manager's REST API?
URL Namehow-to-flush-the-pasoe-extended-deferred-logging-to-disk-using-oe-manager-s-rest-api
Article Number000205699
EnvironmentProduct: OpenEdge
Version: 11.7.6, 12.1 and later
OS: All Supported Platforms
Other: Progress Application Server for OpenEdge (PASOE)
Question/Problem Description

How to flush the PASOE extended deferred logging to disk using OE Manager's REST API?

Steps to Reproduce
Clarifying Information
PASOE deferred logging was previously enabled using commands such as:

/theOepasNameInstanceLocation/bin/oeprop.sh AppServer.SessMgr.defrdLogNumLines=5000
/theOepasNameInstanceLocation/bin/oeprop.sh AppServer.SessMgr.defrdLoggingLevel=5
/theOepasNameInstanceLocation/bin/oeprop.sh AppServer.SessMgr.defrdLogEntryTypes=4GLTrace,ASPlumbing,UBNET,DB.Connects
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The following 4GL code can be used to flush the PASOE deferred logging to disk:
USING OpenEdge.Net.HTTP.RequestBuilder.
USING openedge.net.http.IHttpRequest.
USING openedge.net.http.IHttpResponse.
USING Progress.Json.ObjectModel.*.
USING OpenEdge.Net.HTTP.ClientBuilder.
USING OpenEdge.Net.HTTP.ResponseBuilder.
USING OpenEdge.Net.HTTP.IHttpClientLibrary.
USING OpenEdge.Net.HTTP.Lib.ClientLibraryBuilder.
USING OpenEdge.Net.HTTP.Credentials.

DEFINE VARIABLE oResponse    AS IHttpResponse            NO-UNDO.
DEFINE VARIABLE oEntity      AS JsonObject               NO-UNDO.
DEFINE VARIABLE oCredentials AS Credentials              NO-UNDO.
DEFINE VARIABLE oRequest     AS IHttpRequest             NO-UNDO.
DEFINE VARIABLE oLib         AS IHttpClientLibrary       NO-UNDO.
DEFINE VARIABLE oAgents      AS JsonArray                NO-UNDO.
DEFINE VARIABLE cURL         AS CHARACTER                NO-UNDO.
DEFINE VARIABLE cURL2         AS CHARACTER                NO-UNDO.
DEFINE VARIABLE cMessage     AS CHARACTER                NO-UNDO.
DEFINE VARIABLE lcResponse   AS LONGCHAR                 NO-UNDO.

DEFINE TEMP-TABLE agents NO-UNDO
    FIELD agentId        AS CHARACTER
    FIELD pid            AS CHARACTER
    FIELD state          AS CHARACTER
    FIELD errmsg         AS CHARACTER
    FIELD versionStr     AS CHARACTER
    FIELD versionNo      AS INTEGER
    FIELD outcome        AS CHARACTER
    FIELD operation      AS CHARACTER.

cURL  = "http://localhost:8817/oemanager/applications/oepasName/agents"    . 

oCredentials = NEW Credentials("http://localhost","tomcat","tomcat").

// Make the HTTP call
oRequest = RequestBuilder:Get(cUrl)
                         :UsingBasicAuthentication(oCredentials)
                         :Request.
                             
oResponse = ResponseBuilder:Build():Response.
oLib      = ClientLibraryBuilder:Build():sslVerifyHost(NO):Library.

ClientBuilder:Build()
             :UsingLibrary(oLib)
             :Client:Execute(oRequest,oResponse).

// Cast the result of the call into a JsonObject. 
oEntity  = CAST(oResponse:Entity,JsonObject).
cMessage = oEntity:GetCharacter("errmsg").

IF (cMessage GT "") EQ TRUE THEN DO:
    MESSAGE "Request failed with the below Error:" SKIP(1)
            cMessage
        VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
    RETURN.
END.

// The first object in the response is always named result and the 
// details of the response are children of the result object
// This depicts getting the result object, then getting the agents 
// temp-table (array) from that, in one long chained reference
oAgents = CAST(CAST(oEntity:GetJsonObject('result'),
                    JsonObject):GetJsonArray('agents'),
               JsonArray).

// Read the agents temp-table in 
BUFFER agents:READ-JSON("JsonArray",oAgents,"APPEND").
FOR EACH agents:

    cURL2 = "http://localhost:8817/oemanager/applications/oepasName/agents/" + agents.agentId + "/flushDeferredLog"   .
   
    oRequest = RequestBuilder:Get(cUrl2)
                         :UsingBasicAuthentication(oCredentials)
                         :Request.
   
    oResponse = ResponseBuilder:Build():Response.
    oLib      = ClientLibraryBuilder:Build():sslVerifyHost(NO):Library.

    ClientBuilder:Build()
             :UsingLibrary(oLib)
             :Client:Execute(oRequest,oResponse).
   
END.
in the 4GL code above the 3 lines:
cURL  = "http://localhost:8817/oemanager/applications/oepasName/agents"  .
oCredentials = NEW Credentials("http://localhost","tomcat","tomcat"") .
cURL2 = "http://localhost:8817/oemanager/applications/oepasName/agents/" + agents.agentId + "/flushDeferredLog" .
will need to be edited to use the correct PASOE instance name (instead of oepasName) and the correct PASOE port and tomcat manager login and password.


Executing:
pasman -v -I oepasName env
will show the ports used by the oepasName pasoe instance, for example:
manager http port: 8817
manager https port:8818



After the .p script is executed for example using:
prowin -p flushDefrdLog.p -b
the file /theOepasNameInstanceLocation/logs/oepasName.agent.log should then contain lines like:
[21/10/01@11:44:19.777+0200] P-016228 T-018088 1 AS-Admin MSAS Flushing deferred log ...
[21/10/01@11:44:19.778+0200] P-016228 T-018088 1 AS-Admin MSAS flush deferred log OK

confirming that the pasoe deferred logging was flushed to disk.
Workaround
Notes
Keyword Phrase
Last Modified Date10/11/2021 1:34 PM

Powered by