Home kellton

Main navigation

  • Services
    • Digital Business Services
      • Digital Experience
        • Product Strategy & Consulting
        • Product Design
        • Product Management
      • Product Engineering
        • Digital Application Development
        • Mobile Engineering
        • IoT & Wearables Solutions
        • Quality Engineering
      • Data Engineering & AI
        • Data Engineering
        • Data Science & ML
        • Generative AI & ChatGPT
        • Visualisation & Analytics
        • Integration & API
        • RPA
      • Cloud Engineering
        • Cloud Consulting
        • Cloud Migration
        • Cloud Managed Services
        • DevSecOps
      • NextGen Services
        • Blockchain
        • Web3
        • Metaverse
    • SAP
      • SAP Services
        • S/4HANA Implementations
        • SAP AMS Support
        • SAP Automation
        • SAP Security & GRC
        • SAP Value Added Solutions
        • Other SAP Implementations
  • Platforms & Products
    • Kellton4Health
    • Kellton4NFT
    • Kellton4Commerce
    • KLGAME
    • tHRive
    • Optima
  • Industries
    • Fintech, Banking, Financial Services & Insurance
    • Retail, E-Commerce & Distribution
    • Pharma, Healthcare & Life Sciences
    • Non-Profit, Government & Education
    • Travel, Logistics & Hospitality
    • HiTech, SaaS, ISV & Communications
    • Manufacturing, Automotive & Chemicals
    • Oil,Gas & Mining
    • Energy & Utilities
  • Insights
    • Blogs
    • Brochures
    • Success Stories
    • News / Announcements
    • Webinars
    • White papers
  • Careers
    • Life At Kellton
    • Jobs
  • About
    • About Us
    • Our Partners
    • Our Leadership
    • Testimonials
    • Investors
    • Privacy-Policy
    • Contact Us
Search

Breadcrumb

  1. Home
  2. Blogs
  3. Explained: How to Integrate Log4J2 with webMeth...

Explained: How to Integrate Log4J2 with webMethods?

API Driven Development
Product Engineering
May 07th , 2019
Posted By:
Digital Practice Team
linkedin
Explained: How to Integrate Log4J2 with webMethods?

Related Post

How blockchain-driven innovations can transform global supply chains
Blog
Breaking down barriers: How blockchain-driven innovations can transform global supply chains?
25 May, 2023
Generative AI and ChatGPT
Blog
Redefining the game: Generative AI and ChatGPT unlock new possibilities across industries
11 May, 2023
android testing frameworks
Blog
Best Android automated app testing frameworks in 2023
08 May, 2023

Log4J is a Java-based framework that can be integrated with various platforms and used for custom logging purposes. An upgrade to Log4J with significant improvements, Version 2.x is garbage-free and logs asynchronously using LMAX Disruptor, thereby resulting in low latencies and increased throughput.

Why Log4J? 

Log4J is an independent logging mechanism for webMethods environment. Using custom logs, developers find it easier to log the entry/exit point of each service with the request and response XML. These are also helpful in identifying WARN, INFO, FATAL, ERROR, and DEBUG logs. 

Integrating Log4J2 with webMethods

Below is the step-by-step guide to performing smooth integration of Log4J2 with webMethods. 

Technologies used:
1.    webMethods Integration Server 9.X
2.    Jog4J2 Package and log4j2.xml file
3.    JAR files to place in the Integration Server classpath
 

Step 1: Install Log4J webMethods Package
 

Install the Log4J webMethods package in the webMethods Integration Server. You can download it here: http://techcommunity.softwareag.com/ecosystem/communities/public/webmethods/products/bpm_suite/codesamples/59bf91a8-b1d3-11e4-8d00-cd8d7ef22065/
 

Step 2: Define Appenders and Loggers

 

Edit the "log4j2.xml" file as per your environment and configuration, and place the "log4j2.xml" file in the "...\SoftwareAG\IntegrationServer\instances\default\config" location

The screenshot below shows you the basic environment changes:

1


Log4J provides default Appenders that manage logging of messages to multiple targets. It also provides asynchronous and synchronous loggers. 


The user can create custom Appenders and Loggers. If custom Appenders and Loggers are absent in the "log4j2.xml" file, Log4J will automatically provide the default configuration and will log the data to default folder mentioned in the "log4j2.xml" file.


The screenshot below displays the Default Appender and custom demo Appender.

2

 

3


Step 3: Enable reading of Log4J2.xml through Log4J Wrapper Configurations 

 

Edit the "...\SoftwareAG\profiles\IS_default\configuration\custom_wrapper.conf" file and copy the below settings as shown in the below screenshot:

 

wrapper.java.additional.204=-Dlog4j.configurationFile=file:///c:/SoftwareAG/IntegrationServer/instances/default/config/log4j2.xml
wrapper.java.additional.205=-DAsyncLogger.RingBufferSize=132000
wrapper.java.additional.206=-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
wrapper.java.additional.302=-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector


4


Step 4: Configure Environment Variables


Edit the "...\SoftwareAG\profiles\IS_default\bin\setenv.bat" file and copy the below settings as shown in the screenshot
 

SET JAVA_CUSTOM_OPTS=-Dlog4j.configurationFile=file:///c:/SoftwareAG/IntegrationServer/instances/default/config/log4j2.xml -DAsyncLogger.RingBufferSize=132000 -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

 

5


Step 5: Execute Log4J2 JAR Files
 

Copy the latest "log4j-api-2.8.2.jar," "log4j-core-2.8.2.jar" and "disruptor-3.3.4.jar" (Check for the mentioned JARs in the web for the latest version) files to

"...\SoftwareAG\IntegrationServer\instances\default\packages\Log4j\code\jars" location
 

6


Step 6: Activate Log4J2 Logging in webMethods
 

After completing the above five steps, shutdown and start (do not restart option) the Integration Server.


Implement logging by using the Log4J flow services in the "Log4j" package. You can implement custom logging as per your requirements by making changes to the configuration file and using the flow services in the "Log4j" package.
 

7

Use "Log4j.base.services:logMessage" service for log testing. The flowchart below explains the high-level logic of this wrapper service as implemented by us.
 

8


The screenshot below shows the data logged into the file at the location specified in the "log4j2.xml" file.


 

9

Posted By:
Digital Practice Team
linkedin

Want to know more?

android testing frameworks
Blog
Best Android automated app testing frameworks in 2023
08 May, 2023
Blog image
Blog
10 Best Backend Web Development Frameworks for 2023
17 Apr, 2023
Blog image
Blog
What is Kubernetes? Discover the top 3 Kubernetes trends on the rise in 2023
20 Mar, 2023

Leading you through Digital Transformation journey

North America: +1.844.469.8900

Asia: +91.124.469.8900

Europe: +44.203.807.6911

Email: ask@kellton.com

Footer menu right

  • Digital Experience
  • Data Engineering & AI
  • Nextgen Services
  • About
  • Contact

Footer Menu Left

  • Product Engineering
  • Cloud Engineering
  • SAP Services
  • Careers
  • Success Stories

© 2023 Kellton