SlideShare une entreprise Scribd logo
1  sur  4
1
Log4j
 Log4j is an open source project sponsored by the Apache Software
Foundation
 It is a logging framework written in Java, which provides you with a method
to keep track of exactly what your application is doing
Log4j utilizes a hierarchical structure allowing you to easily control which log
statements are output, while maximizing performance
 This logging structure provides you with several different logging statements of varying
severity (the top of the list is the least severe, while the bottom is the most)
– Trace
– Debug
– Info
– Warn
– Error
– Fatal
 With Log4j you are able to output to many target’s and control every aspect
of the framework through a simple configuration file.
 To use log4j in your EGL project, you will need the log4j jar file, and the
ExternalType in order to access the Java.
2
 Log4j
 If it is not there already, make sure the log4j-1.2.15.jar file exists within the WEB-
INF/lib directory of your project (Refer to the RPG workshop if you need further
instruction on how to do this)
 Right-Click over EGL Source and create a new EGL Source File called
log4jComponent.egl in the package log4j.
 Replace the boiler plate code with the code from the notes
Note that there is only two ExternalType’s
Log4j allows you to specify many different properties for your entire project through a
single configuration file.
3
 Log4j
 We’ll now create the configuration file to control the log4j framework
Right-click over Java Resources:src
Select: New > Other General File
Name the file: log4j.properties
 Copy/Paste the code in the notes into the file
 There are two config files in
the notes of this slide
 The first config file tells log4j
to write to a file
 The second config file, which
is commented out, allows log4j
to write to the console
 Note that the default log level is set to Error, this means that only log’s of greater
severity will be written out. This gives you greater control over all of your log’s, and
the ability to optimize for speed by only turning on certain logging levels when
needed.
4
 Log4j
 Now let’s create a program to test log4j
 Right-click over the programs package
and create a new program called
testLog4j
 Your log4j set up should be working
with your first config file, which sets the
root level to Error and writes out to a
file
Add a break point in the program
Right-Click over the file name and
debug
Note the output in the
“myapplication.log” file created
within the root level of your
workspace
Now uncomment the second line of
code, which overrides the config file
and sets the level to ALLLEVELS
Debug again, note the output now
 Make sure to try the second config file
as well 
Sample Output

Contenu connexe

Tendances

Play Framework Logging
Play Framework LoggingPlay Framework Logging
Play Framework Loggingmitesh_sharma
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in ScalaKnoldus Inc.
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in ScalaKnoldus Inc.
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4Jjkumaranc
 
Shipping your logs to elk from mule app/cloudhub part 2
Shipping your logs to elk from mule app/cloudhub   part 2Shipping your logs to elk from mule app/cloudhub   part 2
Shipping your logs to elk from mule app/cloudhub part 2Alex Fernandez
 
Improving DroidBox
Improving DroidBoxImproving DroidBox
Improving DroidBoxKelwin Yang
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8Knoldus Inc.
 
Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)raj.kamal13
 
Byteman - Carving up your Java code
Byteman - Carving up your Java codeByteman - Carving up your Java code
Byteman - Carving up your Java codeChris Sinjakli
 
Practical byteman sample 20131128
Practical byteman sample 20131128Practical byteman sample 20131128
Practical byteman sample 20131128Jooho Lee
 
10reasons
10reasons10reasons
10reasonsLi Huan
 
Native hook mechanism in Android Bionic linker
Native hook mechanism in Android Bionic linkerNative hook mechanism in Android Bionic linker
Native hook mechanism in Android Bionic linkerKevin Mai-Hsuan Chia
 
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)raj.kamal13
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeMário Almeida
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Robert Stern
 
Come With Golang
Come With GolangCome With Golang
Come With Golang尚文 曾
 
Linker namespace upload
Linker namespace   uploadLinker namespace   upload
Linker namespace uploadBin Yang
 

Tendances (20)

SLF4J Explained........
SLF4J Explained........SLF4J Explained........
SLF4J Explained........
 
Play Framework Logging
Play Framework LoggingPlay Framework Logging
Play Framework Logging
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in Scala
 
SLF4J+Logback
SLF4J+LogbackSLF4J+Logback
SLF4J+Logback
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in Scala
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
Jsp project module
Jsp project moduleJsp project module
Jsp project module
 
Shipping your logs to elk from mule app/cloudhub part 2
Shipping your logs to elk from mule app/cloudhub   part 2Shipping your logs to elk from mule app/cloudhub   part 2
Shipping your logs to elk from mule app/cloudhub part 2
 
Improving DroidBox
Improving DroidBoxImproving DroidBox
Improving DroidBox
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
 
Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)
 
Byteman - Carving up your Java code
Byteman - Carving up your Java codeByteman - Carving up your Java code
Byteman - Carving up your Java code
 
Practical byteman sample 20131128
Practical byteman sample 20131128Practical byteman sample 20131128
Practical byteman sample 20131128
 
10reasons
10reasons10reasons
10reasons
 
Native hook mechanism in Android Bionic linker
Native hook mechanism in Android Bionic linkerNative hook mechanism in Android Bionic linker
Native hook mechanism in Android Bionic linker
 
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skype
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
 
Linker namespace upload
Linker namespace   uploadLinker namespace   upload
Linker namespace upload
 

En vedette

programma_Master_in_medicina_rigenerativa
programma_Master_in_medicina_rigenerativaprogramma_Master_in_medicina_rigenerativa
programma_Master_in_medicina_rigenerativaEmanuele S. Aragona
 
Fase ii yurelys rangel c.i v 10.877.774
Fase  ii  yurelys rangel c.i v 10.877.774Fase  ii  yurelys rangel c.i v 10.877.774
Fase ii yurelys rangel c.i v 10.877.774Yurelys Rangel
 
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...AM Publications
 
Strengths Insight Report
Strengths Insight ReportStrengths Insight Report
Strengths Insight ReportYasemin Cengel
 

En vedette (8)

programma_Master_in_medicina_rigenerativa
programma_Master_in_medicina_rigenerativaprogramma_Master_in_medicina_rigenerativa
programma_Master_in_medicina_rigenerativa
 
Liderazgo
Liderazgo Liderazgo
Liderazgo
 
Bivens CV
Bivens CVBivens CV
Bivens CV
 
Fase ii yurelys rangel c.i v 10.877.774
Fase  ii  yurelys rangel c.i v 10.877.774Fase  ii  yurelys rangel c.i v 10.877.774
Fase ii yurelys rangel c.i v 10.877.774
 
Market Survey
Market SurveyMarket Survey
Market Survey
 
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...
Reduction of PAPR of OFDM Using Exponential Companding Technique with Network...
 
Strengths Insight Report
Strengths Insight ReportStrengths Insight Report
Strengths Insight Report
 
update cv
update cvupdate cv
update cv
 

Similaire à Log4j

Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...
Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...
Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...Chirag Thumar
 
Logging Services for .net - log4net
Logging Services for .net - log4netLogging Services for .net - log4net
Logging Services for .net - log4netGuo Albert
 
Log4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexibleLog4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexibleRamakrishna kapa
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test toolsAllan Huang
 
Rein_in_the_ability_of_log4j
Rein_in_the_ability_of_log4jRein_in_the_ability_of_log4j
Rein_in_the_ability_of_log4jRazorsight
 
WebSphere : High Performance Extensible Logging
WebSphere : High Performance Extensible LoggingWebSphere : High Performance Extensible Logging
WebSphere : High Performance Extensible LoggingJoseph's WebSphere Library
 
Logging configuration in mule
Logging configuration in muleLogging configuration in mule
Logging configuration in muleSon Nguyen
 
Java Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jJava Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jRajiv Gupta
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - LoggingAxel Irriger
 
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfDifferent Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfpCloudy
 
Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslogashok191
 
Log4c developersguide
Log4c developersguideLog4c developersguide
Log4c developersguidehik_lhz
 
Software Engineering - RS4
Software Engineering - RS4Software Engineering - RS4
Software Engineering - RS4AtakanAral
 

Similaire à Log4j (20)

Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...
Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...
Log4j with selenium tutorial: How to Setup log4j logging in selenium automati...
 
Logback
LogbackLogback
Logback
 
Log4e
Log4eLog4e
Log4e
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Logging Services for .net - log4net
Logging Services for .net - log4netLogging Services for .net - log4net
Logging Services for .net - log4net
 
Log4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexibleLog4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexible
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test tools
 
Rein_in_the_ability_of_log4j
Rein_in_the_ability_of_log4jRein_in_the_ability_of_log4j
Rein_in_the_ability_of_log4j
 
Log4e
Log4eLog4e
Log4e
 
WebSphere : High Performance Extensible Logging
WebSphere : High Performance Extensible LoggingWebSphere : High Performance Extensible Logging
WebSphere : High Performance Extensible Logging
 
Java Logging
Java LoggingJava Logging
Java Logging
 
11i Logs
11i Logs11i Logs
11i Logs
 
Logging configuration in mule
Logging configuration in muleLogging configuration in mule
Logging configuration in mule
 
Java Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jJava Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4j
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
 
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdfDifferent Techniques Of Debugging Selenium Based Test Scripts.pdf
Different Techniques Of Debugging Selenium Based Test Scripts.pdf
 
Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslog
 
Log4c developersguide
Log4c developersguideLog4c developersguide
Log4c developersguide
 
Software Engineering - RS4
Software Engineering - RS4Software Engineering - RS4
Software Engineering - RS4
 
J introtojava1-pdf
J introtojava1-pdfJ introtojava1-pdf
J introtojava1-pdf
 

Plus de Krishnakanth Goud

Plus de Krishnakanth Goud (12)

Hibernate java and_oracle
Hibernate java and_oracleHibernate java and_oracle
Hibernate java and_oracle
 
Introduction to Hibernate
Introduction to HibernateIntroduction to Hibernate
Introduction to Hibernate
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
 
Persistence hibernate
Persistence hibernatePersistence hibernate
Persistence hibernate
 
Mule smtp connector
Mule smtp connectorMule smtp connector
Mule smtp connector
 
Fetch records from mysql using mule esb
Fetch records from mysql using mule esbFetch records from mysql using mule esb
Fetch records from mysql using mule esb
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in mule
 
Web service invocation in mule
Web service invocation in muleWeb service invocation in mule
Web service invocation in mule
 
Mule ESB Dropbox connector
Mule ESB Dropbox connectorMule ESB Dropbox connector
Mule ESB Dropbox connector
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Bluetooth
BluetoothBluetooth
Bluetooth
 

Dernier

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 

Dernier (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

Log4j

  • 1. 1 Log4j  Log4j is an open source project sponsored by the Apache Software Foundation  It is a logging framework written in Java, which provides you with a method to keep track of exactly what your application is doing Log4j utilizes a hierarchical structure allowing you to easily control which log statements are output, while maximizing performance  This logging structure provides you with several different logging statements of varying severity (the top of the list is the least severe, while the bottom is the most) – Trace – Debug – Info – Warn – Error – Fatal  With Log4j you are able to output to many target’s and control every aspect of the framework through a simple configuration file.  To use log4j in your EGL project, you will need the log4j jar file, and the ExternalType in order to access the Java.
  • 2. 2  Log4j  If it is not there already, make sure the log4j-1.2.15.jar file exists within the WEB- INF/lib directory of your project (Refer to the RPG workshop if you need further instruction on how to do this)  Right-Click over EGL Source and create a new EGL Source File called log4jComponent.egl in the package log4j.  Replace the boiler plate code with the code from the notes Note that there is only two ExternalType’s Log4j allows you to specify many different properties for your entire project through a single configuration file.
  • 3. 3  Log4j  We’ll now create the configuration file to control the log4j framework Right-click over Java Resources:src Select: New > Other General File Name the file: log4j.properties  Copy/Paste the code in the notes into the file  There are two config files in the notes of this slide  The first config file tells log4j to write to a file  The second config file, which is commented out, allows log4j to write to the console  Note that the default log level is set to Error, this means that only log’s of greater severity will be written out. This gives you greater control over all of your log’s, and the ability to optimize for speed by only turning on certain logging levels when needed.
  • 4. 4  Log4j  Now let’s create a program to test log4j  Right-click over the programs package and create a new program called testLog4j  Your log4j set up should be working with your first config file, which sets the root level to Error and writes out to a file Add a break point in the program Right-Click over the file name and debug Note the output in the “myapplication.log” file created within the root level of your workspace Now uncomment the second line of code, which overrides the config file and sets the level to ALLLEVELS Debug again, note the output now  Make sure to try the second config file as well  Sample Output