SlideShare a Scribd company logo
By Anirban Sen Chowdhary
For logging, Mule ESB uses slf4j, which is a logging facade that discovers and uses
a logging strategy from the classpath, such as log4j2 or the JDK Logger. By default,
Mule includes log4j2, which is configured with a file called log4j2.xml.
We all know how to configure and tweak our log4j2 in our application.
In these slides we will demonstrate of picking a log4j2 file from a specific location
of our choice.
By default, logging in Mule is done asynchronously and at a level greater than or
equal to INFO, and thus discards log messages at the DEBUG or TRACE level.
In Anypoint Studio, log4j2.xml appears in the src/main/resources path.
When an application is deployed, Mule looks for a log4j2 file in the location, as
listed below:-
• log4j2-test.xml in the application classpath
• log4j2.xml in the application classpath
• log4j2-test.xml in the domain classpath
• log4j2.xml in the domain classpath
• log4j2-test.xml in MULE_HOME/conf
• log4j2.xml in MULE_HOME/conf
We can force our Mule application to pick the log4j2 file from the location we want.
Yes, in our application, the log4j2 file will be loaded from the path we will be
specifying
Picking log4j2 for mule
Let us construct our log4j2.xml and rename it as common-log4j2.xml so that we can
highlight our own log4j2.xml and place it in an external location outside our Mule
application. A glimpse of our is as common-log4j2.xml follows :-
Next, we will create a Mule file that will contains the Spring Application Context
that will pick our log4j2.xml which we named as common-log4j2.xml from the
external path mentioned:-
Here you can see the path our log4j2.xml is specified as a property and the value
will be picked from mule-app.properties file.
We will mention the path of our log4j2.xml which we called as common-
log4j2.xml in mule-app.properties file as follows:-
And now we need to place ourcommon-log4j2.xml in the path mentioned in the
properties file from where Spring Application Context will pick up the file for
logging our application.
Please note: In Standalone server, you need to pass dynamically these System
properties value as VM argument as :- -M-Dlog4j2.path=file:///E:/common-
log4j2.xml
Picking log4j2 for mule
Now, when we start our Mule application, we will see in our console that ourlog4j2.xml
file called as common-log4j2.xml is selected from the external path we mentioned in
our Application Context for logging of our application:-
And if you look into our common-log4j2.xml file, you will find that we have configured
<RollingFile/> appenders, which means our application will create a log file :-
If we open this file, we will find our application specific log.
So, here you can see how to use a select our own log4j2.xml file from any external
location dynamically. !!!….You can now try this example by your own and force
your Mule application to pick file of your choice from your selected path 
Picking log4j2 for mule

More Related Content

What's hot (20)

PPTX
Data weave 2.0 advanced (recursion, pattern matching)
ManjuKumara GH
 
PPTX
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
Akshata Sawant
 
PPTX
Introduction to laravel framework
Ahmad Fatoni
 
PPTX
Introduction to MuleSoft
Alexandra N. Martinez
 
PPTX
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
PDF
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
PPTX
Lecture 2_ Intro to laravel.pptx
SaziaRahman
 
PDF
Workflow performance configuration in 12th release
Rolta
 
PDF
Docker on Docker
Docker, Inc.
 
PDF
How to create a User Defined Policy with IBM APIc (v10)
Shiu-Fun Poon
 
PPTX
Mule Runtime: Performance Tuning
MuleSoft
 
PPTX
Introduction to CloudHub 2.0
NeerajKumar1965
 
PDF
MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...
Jitendra Bafna
 
PPT
De Forms a Oracle Fusion Middleware
JC_Diaz_Belmonte
 
PDF
Oracle Fusion Applications Navigation and Roles
Emiconhrd
 
PPTX
Learn mulesoft from scratch
Nikhil More
 
PPTX
Spring Security
Boy Tech
 
PPTX
How to Send IDOC to SAP using MuleSoft
Arul ChristhuRaj Alphonse
 
PDF
Laravel - The PHP Framework for Web Artisans
Windzoon Technologies
 
PDF
Oracle financials functional training on ap, ar & gl
magnifics
 
Data weave 2.0 advanced (recursion, pattern matching)
ManjuKumara GH
 
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
Akshata Sawant
 
Introduction to laravel framework
Ahmad Fatoni
 
Introduction to MuleSoft
Alexandra N. Martinez
 
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
Lecture 2_ Intro to laravel.pptx
SaziaRahman
 
Workflow performance configuration in 12th release
Rolta
 
Docker on Docker
Docker, Inc.
 
How to create a User Defined Policy with IBM APIc (v10)
Shiu-Fun Poon
 
Mule Runtime: Performance Tuning
MuleSoft
 
Introduction to CloudHub 2.0
NeerajKumar1965
 
MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...
Jitendra Bafna
 
De Forms a Oracle Fusion Middleware
JC_Diaz_Belmonte
 
Oracle Fusion Applications Navigation and Roles
Emiconhrd
 
Learn mulesoft from scratch
Nikhil More
 
Spring Security
Boy Tech
 
How to Send IDOC to SAP using MuleSoft
Arul ChristhuRaj Alphonse
 
Laravel - The PHP Framework for Web Artisans
Windzoon Technologies
 
Oracle financials functional training on ap, ar & gl
magnifics
 

Viewers also liked (17)

PPTX
Configuring log4j2
Anirban Sen Chowdhary
 
PPTX
Getting anypoint studios all versions
Anirban Sen Chowdhary
 
PPTX
Calling flow from another application 2
Anirban Sen Chowdhary
 
PPTX
Mule parsing with json part2
Anirban Sen Chowdhary
 
PPTX
Implementing raml in studio
Anirban Sen Chowdhary
 
PDF
JAX London: Crafting Web APIs that Others Love: An Introduction to RAML 1.0
Christian Heidenreich
 
PPTX
Calling database with groovy in mule
Anirban Sen Chowdhary
 
PPTX
Exploration with workbench with raml
Anirban Sen Chowdhary
 
PPTX
Setting filedynamically
Anirban Sen Chowdhary
 
PPTX
Pragmatic REST: recent trends in API design
Marsh Gardiner
 
PPTX
Accessing jms in mule using groovy
Anirban Sen Chowdhary
 
PPTX
Caching a simple way
Anirban Sen Chowdhary
 
PPTX
Calling flow from another application
Anirban Sen Chowdhary
 
PPTX
Mule with drools
Anirban Sen Chowdhary
 
PDF
Mule esb examples
Sashidhar Rao GDS
 
DOCX
Collection Splitter Aggregator in Mule ESB
Kiran Boddepalli
 
PPTX
Mule parsing with json
Anirban Sen Chowdhary
 
Configuring log4j2
Anirban Sen Chowdhary
 
Getting anypoint studios all versions
Anirban Sen Chowdhary
 
Calling flow from another application 2
Anirban Sen Chowdhary
 
Mule parsing with json part2
Anirban Sen Chowdhary
 
Implementing raml in studio
Anirban Sen Chowdhary
 
JAX London: Crafting Web APIs that Others Love: An Introduction to RAML 1.0
Christian Heidenreich
 
Calling database with groovy in mule
Anirban Sen Chowdhary
 
Exploration with workbench with raml
Anirban Sen Chowdhary
 
Setting filedynamically
Anirban Sen Chowdhary
 
Pragmatic REST: recent trends in API design
Marsh Gardiner
 
Accessing jms in mule using groovy
Anirban Sen Chowdhary
 
Caching a simple way
Anirban Sen Chowdhary
 
Calling flow from another application
Anirban Sen Chowdhary
 
Mule with drools
Anirban Sen Chowdhary
 
Mule esb examples
Sashidhar Rao GDS
 
Collection Splitter Aggregator in Mule ESB
Kiran Boddepalli
 
Mule parsing with json
Anirban Sen Chowdhary
 
Ad

Similar to Picking log4j2 for mule (20)

PPTX
Mule debugging logging_configuration_in_mule
kunal vishe
 
PPTX
Mule custom logging
Yamini Saraswathi Narimeta
 
PPTX
Logging configuration in mule
Son Nguyen
 
PPTX
Logger
Srilatha Kante
 
PPTX
Logger
krishashi
 
DOC
Log4j
vasu12
 
PPTX
Milano Meetups #15 - Log Forwarding.pptx
Gonzalo Marcos Ansoain
 
PPTX
Log4j2 - A deep dive into the logging services in Mulesoft with On-Prem deplo...
MysoreMuleSoftMeetup
 
PDF
Milano Meetups #15 - Log Forwarding.pptx.pdf
Florence Consulting
 
PPTX
Mule debugging logging_in_mule
kunal vishe
 
PPTX
Mule esb using file to string and logger component
Germano Barba
 
PPTX
Mule esb using file to string and logger component
Germano Barba
 
PPTX
Mule esb lesson 3
Germano Barba
 
PPTX
Logging best practice in mule using logger component
Govind Mulinti
 
PPTX
Mule io flow
Germano Barba
 
PPTX
Log4j is a reliable, fast and flexible
Ramakrishna kapa
 
PDF
Log4j2
joergreichert
 
PPTX
logs.pptx
FargiOlaOla
 
PPTX
Log4jxml ex
Gagandeep Singh
 
PPTX
Example esb file-to-string flow
Antonio Pellegrino
 
Mule debugging logging_configuration_in_mule
kunal vishe
 
Mule custom logging
Yamini Saraswathi Narimeta
 
Logging configuration in mule
Son Nguyen
 
Logger
krishashi
 
Log4j
vasu12
 
Milano Meetups #15 - Log Forwarding.pptx
Gonzalo Marcos Ansoain
 
Log4j2 - A deep dive into the logging services in Mulesoft with On-Prem deplo...
MysoreMuleSoftMeetup
 
Milano Meetups #15 - Log Forwarding.pptx.pdf
Florence Consulting
 
Mule debugging logging_in_mule
kunal vishe
 
Mule esb using file to string and logger component
Germano Barba
 
Mule esb using file to string and logger component
Germano Barba
 
Mule esb lesson 3
Germano Barba
 
Logging best practice in mule using logger component
Govind Mulinti
 
Mule io flow
Germano Barba
 
Log4j is a reliable, fast and flexible
Ramakrishna kapa
 
logs.pptx
FargiOlaOla
 
Log4jxml ex
Gagandeep Singh
 
Example esb file-to-string flow
Antonio Pellegrino
 
Ad

More from Anirban Sen Chowdhary (20)

PPTX
Change the game with Game changer
Anirban Sen Chowdhary
 
PPTX
Ring central desktop app overview
Anirban Sen Chowdhary
 
PPTX
Overview in ringcentral digital line
Anirban Sen Chowdhary
 
PPTX
Some basics with ring central
Anirban Sen Chowdhary
 
PPTX
Ring central and python
Anirban Sen Chowdhary
 
PPTX
RingCentral application development overview
Anirban Sen Chowdhary
 
PPTX
Cloze connect ringcentral
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors part 4
Anirban Sen Chowdhary
 
PPTX
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors
Anirban Sen Chowdhary
 
PPTX
Call recording overview ring central
Anirban Sen Chowdhary
 
PPTX
Ring central engaging with amazon alexa
Anirban Sen Chowdhary
 
PPTX
How ring central sdk changing the game
Anirban Sen Chowdhary
 
PPTX
When ring central connect salesforce
Anirban Sen Chowdhary
 
PPTX
Mule 4 connecting ring central
Anirban Sen Chowdhary
 
PPTX
Ring central sdk
Anirban Sen Chowdhary
 
PPTX
Ring central with okta
Anirban Sen Chowdhary
 
PPTX
Ring central connecting salesforce overview
Anirban Sen Chowdhary
 
PPTX
Ring central call logs overview (part 2)
Anirban Sen Chowdhary
 
Change the game with Game changer
Anirban Sen Chowdhary
 
Ring central desktop app overview
Anirban Sen Chowdhary
 
Overview in ringcentral digital line
Anirban Sen Chowdhary
 
Some basics with ring central
Anirban Sen Chowdhary
 
Ring central and python
Anirban Sen Chowdhary
 
RingCentral application development overview
Anirban Sen Chowdhary
 
Cloze connect ringcentral
Anirban Sen Chowdhary
 
Overview on ring central errors part 4
Anirban Sen Chowdhary
 
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
Overview on ring central errors
Anirban Sen Chowdhary
 
Call recording overview ring central
Anirban Sen Chowdhary
 
Ring central engaging with amazon alexa
Anirban Sen Chowdhary
 
How ring central sdk changing the game
Anirban Sen Chowdhary
 
When ring central connect salesforce
Anirban Sen Chowdhary
 
Mule 4 connecting ring central
Anirban Sen Chowdhary
 
Ring central sdk
Anirban Sen Chowdhary
 
Ring central with okta
Anirban Sen Chowdhary
 
Ring central connecting salesforce overview
Anirban Sen Chowdhary
 
Ring central call logs overview (part 2)
Anirban Sen Chowdhary
 

Recently uploaded (20)

PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
PDF
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
PDF
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PDF
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
PPTX
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
PPTX
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PDF
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
PDF
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
Productivity Management Software | Workstatus
Lovely Baghel
 
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 

Picking log4j2 for mule

  • 1. By Anirban Sen Chowdhary
  • 2. For logging, Mule ESB uses slf4j, which is a logging facade that discovers and uses a logging strategy from the classpath, such as log4j2 or the JDK Logger. By default, Mule includes log4j2, which is configured with a file called log4j2.xml. We all know how to configure and tweak our log4j2 in our application. In these slides we will demonstrate of picking a log4j2 file from a specific location of our choice.
  • 3. By default, logging in Mule is done asynchronously and at a level greater than or equal to INFO, and thus discards log messages at the DEBUG or TRACE level. In Anypoint Studio, log4j2.xml appears in the src/main/resources path. When an application is deployed, Mule looks for a log4j2 file in the location, as listed below:- • log4j2-test.xml in the application classpath • log4j2.xml in the application classpath • log4j2-test.xml in the domain classpath • log4j2.xml in the domain classpath • log4j2-test.xml in MULE_HOME/conf • log4j2.xml in MULE_HOME/conf
  • 4. We can force our Mule application to pick the log4j2 file from the location we want. Yes, in our application, the log4j2 file will be loaded from the path we will be specifying
  • 6. Let us construct our log4j2.xml and rename it as common-log4j2.xml so that we can highlight our own log4j2.xml and place it in an external location outside our Mule application. A glimpse of our is as common-log4j2.xml follows :-
  • 7. Next, we will create a Mule file that will contains the Spring Application Context that will pick our log4j2.xml which we named as common-log4j2.xml from the external path mentioned:-
  • 8. Here you can see the path our log4j2.xml is specified as a property and the value will be picked from mule-app.properties file. We will mention the path of our log4j2.xml which we called as common- log4j2.xml in mule-app.properties file as follows:- And now we need to place ourcommon-log4j2.xml in the path mentioned in the properties file from where Spring Application Context will pick up the file for logging our application. Please note: In Standalone server, you need to pass dynamically these System properties value as VM argument as :- -M-Dlog4j2.path=file:///E:/common- log4j2.xml
  • 10. Now, when we start our Mule application, we will see in our console that ourlog4j2.xml file called as common-log4j2.xml is selected from the external path we mentioned in our Application Context for logging of our application:-
  • 11. And if you look into our common-log4j2.xml file, you will find that we have configured <RollingFile/> appenders, which means our application will create a log file :- If we open this file, we will find our application specific log.
  • 12. So, here you can see how to use a select our own log4j2.xml file from any external location dynamically. !!!….You can now try this example by your own and force your Mule application to pick file of your choice from your selected path 