How to use OpenEdge.Logging component? - Forum - OpenEdge Development - Progress Community

How to use OpenEdge.Logging component?

 Forum

How to use OpenEdge.Logging component?

This question is answered

a) I'm trying to figure out the usage of OpenEdge.Logging component using very basic test. For the test I have place the logging.config file in a dir which is in propath and created a simple class but the log file is not created on the disk. Can someone point out what am I doing wrong here?

OS: Mint Linux, Progress Version: 11.7.5, Code executor: Progress Editor

1. logging.config file

{
    "DEFAULT_LOGGER": "OpenEdge",
    "logger": {
        "OpenEdge": {
            "logLevel": "ERROR",
            "filters": [
                "LOG_MANAGER_FORMAT",
                {
                    "filterName": "LOG_MANAGER_WRITER",
                    "fileName": "/tmp/OpenEdge.log",
                    "appendTo": true
                }
            ]
        },
        "TestLogging": {
            "logLevel": "ERROR",
            "filters": [
                "LOG_MANAGER_FORMAT",
                {
                    "filterName": "LOG_MANAGER_WRITER",
                    "fileName": "/tmp/TestLogging.log",
                    "appendTo": true
                }
            ]
        }
    }
}

2. TestLogging.cls

using OpenEdge.Logging.ILogWriter.
using OpenEdge.Logging.LoggerBuilder.

class TestLogging:
    define variable logger as ILogWriter no-undo.

constructor TestLogging():
    MESSAGE SEARCH("logging.config").
    logger = LoggerBuilder:GetLogger(GET-CLASS(TestLogging)).
    logger:Info("Customer record found").
    logger:Warn("CUSTOMER-MESSAGES", "Customer record missing").
end.

end class.

b)  Eventually I want to produce logs using logging framework/component in JSON format readable by LogStash, so it would be nice it someone can also point out to a reference implementation. We are simply using ABL client and not PASOE, BPM etc. 

Verified Answer
  • The logging component is intended to work on any ABL client. There are some defaults that are established differently dependeing on the client type.
     
    (a)   "filterName" should be "name" for the filter names. You should see errors in the session temp-dir (-T) in a file called loggerbuilder.log .
     
    (b) You can potentially add a filter that converts a LogEvent and/or its LogMessage into JSON and sends that to a network location.  I did a talk on extending the logger component earlier this year, and there's a demo on sending log events to an ELK stack; that demo code is at github.com/.../abl-logging-demo .
     
     
     
     
All Replies
  • The logging component is intended to work on any ABL client. There are some defaults that are established differently dependeing on the client type.
     
    (a)   "filterName" should be "name" for the filter names. You should see errors in the session temp-dir (-T) in a file called loggerbuilder.log .
     
    (b) You can potentially add a filter that converts a LogEvent and/or its LogMessage into JSON and sends that to a network location.  I did a talk on extending the logger component earlier this year, and there's a demo on sending log events to an ELK stack; that demo code is at github.com/.../abl-logging-demo .
     
     
     
     
  • Thanks a lot .

    a) Now I'm able to find my log files :). I found the the format of the logging.config by extracting OpenEdge.Core.pl (ver 11.7.5) and seems the logging.config.example file is wrong and misleading. Perhaps should be reported for fixing.

    b) Thanks for pointing out the examples.