SlideShare una empresa de Scribd logo
1 de 40
http://logging.apache.org/log4j/docs/   Sylvain Bouchard
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Logging, a definition
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic features of any logging library are ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Level ,[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Appenders ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],<!ELEMENT appender (errorHandler?, param*, layout?, filter*,    appender-ref*)>  <!ATTLIST appender  name ID #REQUIRED  class CDATA #REQUIRED  >  log4j.dtd
[object Object],[object Object],[object Object],<appender name=&quot;console&quot; class=&quot;org.apache.log4j.ConsoleAppender&quot;>   <param name=&quot;Target&quot; value=&quot;System.out&quot;/>   <layout class=&quot;org.apache.log4j.PatternLayout&quot;>   <param name=&quot;ConversionPattern&quot; value=&quot;%-5p %c{1} - %m%n&quot;/>   </layout>  </appender>   A simple  example
Appenders  Configuration Example <appender name=&quot;FileAppender&quot; class=&quot; org.apache.log4j.FileAppender &quot;> <param name=&quot; File &quot; value=&quot;/log/myFile.log&quot; /> <param name=&quot; Append &quot; value=&quot;true&quot; /> <param name=&quot; Threshold &quot; value=&quot;INFO&quot;/> . . . </appender> FileAppenders:  Appends log events to a file.   File : path and filename of the file. Append :  If true, open the file in append mode. If false, open in truncate mode. Threshold : Set the threshold level. All log events with lower level than the threshold level are ignored by the appender.  (TRACE, DEBUG, INFO, WARN, ERROR and FATAL) ImmediateFlush :  Default is true, meaning log messages are not buffered at all which is what you want almost all of the time.
<appender name=&quot;RollingFileSample&quot; class=&quot; org.apache.log4j.RollingFileAppender &quot;> <param name=&quot;File&quot; value=&quot;/log/myRollingFile.log&quot;/> <param name=&quot;Append&quot; value=&quot;true&quot;/> <param name=&quot; MaxFileSize &quot; value=&quot;500KB&quot;/> <param name=&quot; MaxBackupIndex &quot; value=&quot;1&quot;/> . . . </appender> RollingFileAppenders:  Extends FileAppender to backup the log files when    they reach a certain size . MaxFileSize :  Set the maximum size that the output file is allowed to reach before being rolled    over to backup files. You can specify the value with the suffixes &quot;KB&quot;,&quot;MB&quot; or  &quot;GB“. MaxBackupIndex :  Set the maximum number of backup files to keep around. 0 means no backup files at all. * Plus all parameters from fileAppender
<appender name=&quot;DRFileSample&quot; class=&quot; org.apache.log4j.DailyRollingFileAppender &quot;> <param name=&quot;File&quot; value=&quot;/log/myDailyFile.log&quot;/> <param name=&quot;DatePattern&quot; value=&quot;'.'yyyy-MM-dd'.log'&quot;/> <layout class=&quot;org.apache.log4j.PatternLayout&quot;> <param name=&quot;ConversionPattern&quot; value=&quot;%d %-5p [%c] %m%n&quot;/> </layout> </appender> DailyRollingFileAppender:  Extends FileAppender so that the underlying file is   rolled over at a user chosen frequency. DatePattern   : Takes a string in the same format as expected by  SimpleDateFormat .  This options determines the rollover schedule. Ex: DatePattern  Rollover schedule '.'yyyy-MM'  Rollover at the beginning of each month '.'yyyy-MM-dd'  Rollover at midnight each day. '.'yyyy-MM-dd-HH'  Rollover at the top of every hour. where '.' represent your filename in the datePattern * Plus all parameters from fileAppender
<appender name=&quot;CONSOLE&quot; class=&quot; org.apache.log4j.ConsoleAppender &quot;> <param name=&quot; Target &quot; value=&quot;System.out&quot;/> <param name=&quot; Threshold &quot; value=&quot;INFO&quot;/> . . . </appender> ConsoleAppender:  appends log events to System.out or System.err using a layout    specified by the user. The default target is System.out. Target :   Recognized values are &quot;System.out&quot; and &quot;System.err&quot;.  Any other value will be ignored. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL. ImmediateFlush :  Default is true, meaning log messages are not buffered at all which is what you    want almost all of the time.
<appender name=&quot;JDBCSample&quot; class=&quot; org.apache.log4j.jdbc.JDBCAppender &quot;> <param name=&quot; Threshold &quot; value=&quot;ERROR&quot;/> <param name=&quot; driver &quot; value=&quot;com.sybase.jdbc2.jdbc.SybDriver&quot;/> <param name=&quot; URL &quot; value=&quot;jdbc:sybase:Tds:127.0.0.1:2638/Summit&quot;/> <param name=&quot; user &quot; value=&quot;DBA&quot;/> <param name=&quot; password &quot; value=&quot;SQL&quot;/> . . .  </appender> JDBCAppender:  sending log events to a database.   Driver :   Ensures that the given driver class has been loaded for SQL connection creation.  URL : url / jdbc connection. user : Connection username. password : Connection username. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
<appender name=&quot;EmailSample&quot; class=&quot; org.apache.log4j.net.SMTPAppender &quot;> <param name=&quot; Threshold &quot; value=&quot;FATAL&quot;/> <param name=&quot; To &quot; value=&quot;name@email.com&quot;/> <param name=&quot; From &quot; value=&quot;name@email.com&quot;/> <param name=&quot; Subject &quot; value=&quot;One Fatal Error&quot;/> <param name=&quot; SMTPHost &quot; value=&quot;localhost&quot;/> <param name=&quot; BufferSize &quot; value=&quot;10&quot;/> . . .  </appender> SMTPAppender:  Send an e-mail when a specific logging event occurs. To, From :   takes a string value which should be a comma separated list of e-mail address of    the recipients / sender. Cc, Bcc : the cc and bcc recipient addresses. Subject : the subject of the e-mail message. SMTHHost : the host name of the SMTP server that will send the e-mail message. SMTHUsername : the username required to authenticate against the mail server. SMTHPassword : the password required to authenticate against the mail server. BufferSize : the maximum number of logging events to collect in a cyclic buffer. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Loggers ,[object Object],<root>    <priority value =&quot;debug&quot; />    <appender-ref ref=&quot;console&quot; />  </root>  The root logger is configured to output log message at level &quot;debug&quot; or higher to the appender named &quot;console&quot;. All loggers inherit their settings from the  root   logger, so with no other configuration settings, all loggers will output all of their messages to the &quot;console&quot; appender automatically. This may be fine for simple debugging, but eventually more specific logger  configuration is going to be required.
[object Object],[object Object],[object Object],[object Object],<!ELEMENT logger (level?,appender-ref*)>  <!ATTLIST logger  name ID #REQUIRED  additivity (true|false) &quot;true&quot;  >   log4j.dtd
[object Object],[object Object],<logger name=&quot;com.mycompany.apackage.MyClass&quot;>    <level value=&quot;info&quot;/> </logger> A simple  example
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Layouts ,[object Object],[object Object],[object Object],SimpleLayout -  org.apache.log4j.SimpleLayout SimpleLayout consists of the priority of the log statement, followed by &quot; - &quot; and then the log message itself.  For example: DEBUG - Hello world <!ELEMENT layout (param*)>  <!ATTLIST layout  class CDATA #REQUIRED  >  log4j.dtd
PatternLayout -  org.apache.log4j.PatternLayout   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],PatternLayout - Example
XMLLayout  - org.apache.log4j.xml.XMLLayout The output of the XMLLayout consists of a series of log4j:event elements as defined in the log4j.dtd. It does not output a complete well-formed XML file. The output is designed to be included as an external entity in a separate file to form a correct XML file. For example, if abc is the name of the faile where the XMLLayout output goes, then a well-formed XML file would be:   <log4j:event logger=&quot;com.ing.canada.myPackage.MyClass&quot;    timestamp=&quot;1165519924224&quot; level=&quot;FATAL&quot;    thread=&quot;Servlet.Engine.Transports : 0&quot;> <log4j:message> <![CDATA[TEST FATAL. debug]]>   </log4j:message> </log4j:event>
HTMLLayout  -  org.apache.log4j.HTMLLayout  This layout outputs events in a HTML table.  <body bgcolor=&quot;#FFFFFF&quot; topmargin=&quot;6&quot; leftmargin=&quot;6&quot;> <hr size=&quot;1&quot; noshade> Log session start time Thu Dec 07 15:03:00 EST 2006<br><br> <table cellspacing=&quot;0&quot; cellpadding=&quot;4&quot; border=&quot;1&quot; bordercolor=&quot;#224466&quot; width=&quot;100%&quot;> <tr> <th>Time</th><th>Thread</th><th>Level</th><th>Category</th> <th>File:Line</th><th>Message</th> </tr> <tr> <td>16</td> <td title=&quot;Servlet.Engine.Transports : 0 thread&quot;>Servlet.Engine.Transports : 0</td> <td title=&quot;Level&quot;><font color=&quot;#993300&quot;><strong>FATAL</strong></font></td> <td title=&quot;com.ing.canada.autoquote.filter.SessionAttributesFiltercategory&quot;>   com.ing.canada.autoquote.filter.SessionAttributesFilter </td> <td>SessionAttributesFilter.java:66</td> <td title=&quot;Message&quot;>TEST FATAL. debug</td> </tr>
Layout  Configuration Example <layout class=&quot;org.apache.log4j. PatternLayout &quot;> <param name=&quot; ConversionPattern &quot; value=&quot;%d %-5p [%c] %m%n&quot;/> </layout> <layout class=&quot;org.apache.log4j.xml. XMLLayout &quot;> <param name=&quot; LocationInfo &quot; value=&quot;true&quot; /> </layout> <layout class=&quot;org.apache.log4j. HTMLLayout &quot;> <param name=&quot;LocationInfo&quot; value=&quot;true&quot; /> <param name=&quot; Title &quot; value=“Html Title&quot; /> </layout> ConvesionPattern : This is the string which controls formatting and consists of a mix of literal  content and conversion specifiers.   LocationInfo : If the the option is set to true, then the file name and line number of the statement at the    origin of  the log statement will be output. Default is false. Title : This option sets the document title of the generated HTML document.
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Filters ,[object Object],[object Object],[object Object],[object Object],[object Object]
LevelMatchFilter   The filter admits two options LevelToMatch and AcceptOnMatch. LevelToMatch: TRACE, DEBUG, INFO, WARN, ERROR or  FATAL AcceptOnMatch:  If acceptOnMatch is set to true (default) and the level match the criteria all  others filters will not be execute and the message will be accepted. Otherwise the message is rejected   and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.LevelMatchFilter &quot;> <param name=&quot; LevelToMatch &quot; value=&quot;INFO&quot;/> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot;/> </filter>  Filter based on level matching .
LevelRangeFilter The filter admits three options LevelMin, LevelMax and AcceptOnMatch. LevelMin: TRACE, DEBUG, INFO, WARN, ERROR or  FATAL LevelMin: TRACE, DEBUG, INFO, WARN, ERROR or  FATAL AcceptOnMatch:  If acceptOnMatch is set to true (default) and the level match the criteria all others filters will not be execute and the message will be accepted. Otherwise the message is rejected   and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.LevelRangeFilter &quot;> <param name=&quot; LevelMin &quot; value=&quot;DEBUG&quot;/> <param name=&quot; LevelMax &quot; value=&quot;ERROR&quot;/> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot;/> </filter> Filter based on level matching, which can be used to reject messages with priorities  outside a certain range (inclusive).
StringMatchFilter   The filter admits two options StringToMatch and AcceptOnMatch. StringToMatch: String to find in the message AcceptOnMatch:  If acceptOnMatch is set to true (default) and the level match the criteria all  others filters will not be execute and the message will be accepted. Otherwise the message is rejected   and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.StringMatchFilter &quot;> <param name=&quot; StringToMatch &quot; value=&quot;1&quot; /> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot; /> </filter> Filter based on string matching (Case sensitive) .
DenyAllFilter   You can add this filter to the end of a filter chain to switch from the default &quot;accept all unless instructed otherwise&quot; filtering behaviour to a &quot;deny all unless instructed otherwise&quot; behaviour.  <filter class=&quot; org.apache.log4j.varia.DenyAllFilter &quot;/> This filter drops all logging events.
Log4j.xml ,[object Object],[object Object],<!ELEMENT appender (errorHandler?, param*, layout?, filter*,    appender-ref*)>  <!ATTLIST log4j:configuration  xmlns:log4j  CDATA #FIXED &quot;http://jakarta.apache.org/log4j/&quot;    threshold  (all|debug|info|warn|error|fatal|off|null) &quot;null“   debug  (true|false|null)  &quot;null&quot; >
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],Tips

Más contenido relacionado

La actualidad más candente

Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
yucefmerhi
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
Suite Solutions
 
OWASP Top 10 : Let’s know & solve
OWASP Top 10 : Let’s know & solveOWASP Top 10 : Let’s know & solve
OWASP Top 10 : Let’s know & solve
Harit Kothari
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overview
stn_tkiller
 

La actualidad más candente (16)

Ot performance webinar
Ot performance webinarOt performance webinar
Ot performance webinar
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
 
OWASP Top 10 : Let’s know & solve
OWASP Top 10 : Let’s know & solveOWASP Top 10 : Let’s know & solve
OWASP Top 10 : Let’s know & solve
 
Perl Tidy Perl Critic
Perl Tidy Perl CriticPerl Tidy Perl Critic
Perl Tidy Perl Critic
 
Php Best Practices
Php Best PracticesPhp Best Practices
Php Best Practices
 
Using Jenkins for Continuous Integration of Perl components OSD2011
Using Jenkins for Continuous Integration of Perl components OSD2011 Using Jenkins for Continuous Integration of Perl components OSD2011
Using Jenkins for Continuous Integration of Perl components OSD2011
 
Http Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacksHttp Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacks
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overview
 
Php Debugger
Php DebuggerPhp Debugger
Php Debugger
 
HTTP Parameter Pollution (HPP) - SEaCURE.it edition
HTTP Parameter Pollution (HPP) - SEaCURE.it editionHTTP Parameter Pollution (HPP) - SEaCURE.it edition
HTTP Parameter Pollution (HPP) - SEaCURE.it edition
 
10 Sets of Best Practices for Java 8
10 Sets of Best Practices for Java 810 Sets of Best Practices for Java 8
10 Sets of Best Practices for Java 8
 
Java 8 ​and ​Best Practices
Java 8 ​and ​Best PracticesJava 8 ​and ​Best Practices
Java 8 ​and ​Best Practices
 
TDD, BDD, RSpec
TDD, BDD, RSpecTDD, BDD, RSpec
TDD, BDD, RSpec
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 

Similar a Presentation log4 j

10reasons
10reasons10reasons
10reasons
Li Huan
 
Krazykoder struts2 plugins
Krazykoder struts2 pluginsKrazykoder struts2 plugins
Krazykoder struts2 plugins
Krazy Koder
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
David Calavera
 

Similar a Presentation log4 j (20)

10reasons
10reasons10reasons
10reasons
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
 
Solr Presentation
Solr PresentationSolr Presentation
Solr Presentation
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Expanding a tree node
Expanding a tree nodeExpanding a tree node
Expanding a tree node
 
Dan Holevoet, Google
Dan Holevoet, GoogleDan Holevoet, Google
Dan Holevoet, Google
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
Struts2
Struts2Struts2
Struts2
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
 
Log4j
Log4jLog4j
Log4j
 
Python scripting kick off
Python scripting kick offPython scripting kick off
Python scripting kick off
 
Krazykoder struts2 plugins
Krazykoder struts2 pluginsKrazykoder struts2 plugins
Krazykoder struts2 plugins
 
Struts2
Struts2Struts2
Struts2
 
Lemur Tutorial at SIGIR 2006
Lemur Tutorial at SIGIR 2006Lemur Tutorial at SIGIR 2006
Lemur Tutorial at SIGIR 2006
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
 
Back-2-Basics: Exception & Event Instrumentation in .NET
Back-2-Basics: Exception & Event Instrumentation in .NETBack-2-Basics: Exception & Event Instrumentation in .NET
Back-2-Basics: Exception & Event Instrumentation in .NET
 
Back-2-Basics: Exception & Event Instrumentation in .NET
Back-2-Basics: Exception & Event Instrumentation in .NETBack-2-Basics: Exception & Event Instrumentation in .NET
Back-2-Basics: Exception & Event Instrumentation in .NET
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

Presentation log4 j

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Appenders Configuration Example <appender name=&quot;FileAppender&quot; class=&quot; org.apache.log4j.FileAppender &quot;> <param name=&quot; File &quot; value=&quot;/log/myFile.log&quot; /> <param name=&quot; Append &quot; value=&quot;true&quot; /> <param name=&quot; Threshold &quot; value=&quot;INFO&quot;/> . . . </appender> FileAppenders: Appends log events to a file. File : path and filename of the file. Append : If true, open the file in append mode. If false, open in truncate mode. Threshold : Set the threshold level. All log events with lower level than the threshold level are ignored by the appender. (TRACE, DEBUG, INFO, WARN, ERROR and FATAL) ImmediateFlush : Default is true, meaning log messages are not buffered at all which is what you want almost all of the time.
  • 13. <appender name=&quot;RollingFileSample&quot; class=&quot; org.apache.log4j.RollingFileAppender &quot;> <param name=&quot;File&quot; value=&quot;/log/myRollingFile.log&quot;/> <param name=&quot;Append&quot; value=&quot;true&quot;/> <param name=&quot; MaxFileSize &quot; value=&quot;500KB&quot;/> <param name=&quot; MaxBackupIndex &quot; value=&quot;1&quot;/> . . . </appender> RollingFileAppenders: Extends FileAppender to backup the log files when they reach a certain size . MaxFileSize : Set the maximum size that the output file is allowed to reach before being rolled over to backup files. You can specify the value with the suffixes &quot;KB&quot;,&quot;MB&quot; or &quot;GB“. MaxBackupIndex : Set the maximum number of backup files to keep around. 0 means no backup files at all. * Plus all parameters from fileAppender
  • 14. <appender name=&quot;DRFileSample&quot; class=&quot; org.apache.log4j.DailyRollingFileAppender &quot;> <param name=&quot;File&quot; value=&quot;/log/myDailyFile.log&quot;/> <param name=&quot;DatePattern&quot; value=&quot;'.'yyyy-MM-dd'.log'&quot;/> <layout class=&quot;org.apache.log4j.PatternLayout&quot;> <param name=&quot;ConversionPattern&quot; value=&quot;%d %-5p [%c] %m%n&quot;/> </layout> </appender> DailyRollingFileAppender: Extends FileAppender so that the underlying file is rolled over at a user chosen frequency. DatePattern : Takes a string in the same format as expected by SimpleDateFormat . This options determines the rollover schedule. Ex: DatePattern Rollover schedule '.'yyyy-MM' Rollover at the beginning of each month '.'yyyy-MM-dd' Rollover at midnight each day. '.'yyyy-MM-dd-HH' Rollover at the top of every hour. where '.' represent your filename in the datePattern * Plus all parameters from fileAppender
  • 15. <appender name=&quot;CONSOLE&quot; class=&quot; org.apache.log4j.ConsoleAppender &quot;> <param name=&quot; Target &quot; value=&quot;System.out&quot;/> <param name=&quot; Threshold &quot; value=&quot;INFO&quot;/> . . . </appender> ConsoleAppender: appends log events to System.out or System.err using a layout specified by the user. The default target is System.out. Target : Recognized values are &quot;System.out&quot; and &quot;System.err&quot;. Any other value will be ignored. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL. ImmediateFlush : Default is true, meaning log messages are not buffered at all which is what you want almost all of the time.
  • 16. <appender name=&quot;JDBCSample&quot; class=&quot; org.apache.log4j.jdbc.JDBCAppender &quot;> <param name=&quot; Threshold &quot; value=&quot;ERROR&quot;/> <param name=&quot; driver &quot; value=&quot;com.sybase.jdbc2.jdbc.SybDriver&quot;/> <param name=&quot; URL &quot; value=&quot;jdbc:sybase:Tds:127.0.0.1:2638/Summit&quot;/> <param name=&quot; user &quot; value=&quot;DBA&quot;/> <param name=&quot; password &quot; value=&quot;SQL&quot;/> . . . </appender> JDBCAppender: sending log events to a database. Driver : Ensures that the given driver class has been loaded for SQL connection creation. URL : url / jdbc connection. user : Connection username. password : Connection username. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
  • 17. <appender name=&quot;EmailSample&quot; class=&quot; org.apache.log4j.net.SMTPAppender &quot;> <param name=&quot; Threshold &quot; value=&quot;FATAL&quot;/> <param name=&quot; To &quot; value=&quot;name@email.com&quot;/> <param name=&quot; From &quot; value=&quot;name@email.com&quot;/> <param name=&quot; Subject &quot; value=&quot;One Fatal Error&quot;/> <param name=&quot; SMTPHost &quot; value=&quot;localhost&quot;/> <param name=&quot; BufferSize &quot; value=&quot;10&quot;/> . . . </appender> SMTPAppender: Send an e-mail when a specific logging event occurs. To, From : takes a string value which should be a comma separated list of e-mail address of the recipients / sender. Cc, Bcc : the cc and bcc recipient addresses. Subject : the subject of the e-mail message. SMTHHost : the host name of the SMTP server that will send the e-mail message. SMTHUsername : the username required to authenticate against the mail server. SMTHPassword : the password required to authenticate against the mail server. BufferSize : the maximum number of logging events to collect in a cyclic buffer. Threshold : TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. XMLLayout - org.apache.log4j.xml.XMLLayout The output of the XMLLayout consists of a series of log4j:event elements as defined in the log4j.dtd. It does not output a complete well-formed XML file. The output is designed to be included as an external entity in a separate file to form a correct XML file. For example, if abc is the name of the faile where the XMLLayout output goes, then a well-formed XML file would be: <log4j:event logger=&quot;com.ing.canada.myPackage.MyClass&quot; timestamp=&quot;1165519924224&quot; level=&quot;FATAL&quot; thread=&quot;Servlet.Engine.Transports : 0&quot;> <log4j:message> <![CDATA[TEST FATAL. debug]]> </log4j:message> </log4j:event>
  • 30. HTMLLayout - org.apache.log4j.HTMLLayout This layout outputs events in a HTML table. <body bgcolor=&quot;#FFFFFF&quot; topmargin=&quot;6&quot; leftmargin=&quot;6&quot;> <hr size=&quot;1&quot; noshade> Log session start time Thu Dec 07 15:03:00 EST 2006<br><br> <table cellspacing=&quot;0&quot; cellpadding=&quot;4&quot; border=&quot;1&quot; bordercolor=&quot;#224466&quot; width=&quot;100%&quot;> <tr> <th>Time</th><th>Thread</th><th>Level</th><th>Category</th> <th>File:Line</th><th>Message</th> </tr> <tr> <td>16</td> <td title=&quot;Servlet.Engine.Transports : 0 thread&quot;>Servlet.Engine.Transports : 0</td> <td title=&quot;Level&quot;><font color=&quot;#993300&quot;><strong>FATAL</strong></font></td> <td title=&quot;com.ing.canada.autoquote.filter.SessionAttributesFiltercategory&quot;> com.ing.canada.autoquote.filter.SessionAttributesFilter </td> <td>SessionAttributesFilter.java:66</td> <td title=&quot;Message&quot;>TEST FATAL. debug</td> </tr>
  • 31. Layout Configuration Example <layout class=&quot;org.apache.log4j. PatternLayout &quot;> <param name=&quot; ConversionPattern &quot; value=&quot;%d %-5p [%c] %m%n&quot;/> </layout> <layout class=&quot;org.apache.log4j.xml. XMLLayout &quot;> <param name=&quot; LocationInfo &quot; value=&quot;true&quot; /> </layout> <layout class=&quot;org.apache.log4j. HTMLLayout &quot;> <param name=&quot;LocationInfo&quot; value=&quot;true&quot; /> <param name=&quot; Title &quot; value=“Html Title&quot; /> </layout> ConvesionPattern : This is the string which controls formatting and consists of a mix of literal content and conversion specifiers. LocationInfo : If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output. Default is false. Title : This option sets the document title of the generated HTML document.
  • 32.
  • 33.
  • 34. LevelMatchFilter The filter admits two options LevelToMatch and AcceptOnMatch. LevelToMatch: TRACE, DEBUG, INFO, WARN, ERROR or FATAL AcceptOnMatch: If acceptOnMatch is set to true (default) and the level match the criteria all others filters will not be execute and the message will be accepted. Otherwise the message is rejected and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.LevelMatchFilter &quot;> <param name=&quot; LevelToMatch &quot; value=&quot;INFO&quot;/> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot;/> </filter> Filter based on level matching .
  • 35. LevelRangeFilter The filter admits three options LevelMin, LevelMax and AcceptOnMatch. LevelMin: TRACE, DEBUG, INFO, WARN, ERROR or FATAL LevelMin: TRACE, DEBUG, INFO, WARN, ERROR or FATAL AcceptOnMatch: If acceptOnMatch is set to true (default) and the level match the criteria all others filters will not be execute and the message will be accepted. Otherwise the message is rejected and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.LevelRangeFilter &quot;> <param name=&quot; LevelMin &quot; value=&quot;DEBUG&quot;/> <param name=&quot; LevelMax &quot; value=&quot;ERROR&quot;/> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot;/> </filter> Filter based on level matching, which can be used to reject messages with priorities outside a certain range (inclusive).
  • 36. StringMatchFilter The filter admits two options StringToMatch and AcceptOnMatch. StringToMatch: String to find in the message AcceptOnMatch: If acceptOnMatch is set to true (default) and the level match the criteria all others filters will not be execute and the message will be accepted. Otherwise the message is rejected and passed to the next filter. <filter class=&quot; org.apache.log4j.varia.StringMatchFilter &quot;> <param name=&quot; StringToMatch &quot; value=&quot;1&quot; /> <param name=&quot; AcceptOnMatch &quot; value=&quot;true&quot; /> </filter> Filter based on string matching (Case sensitive) .
  • 37. DenyAllFilter You can add this filter to the end of a filter chain to switch from the default &quot;accept all unless instructed otherwise&quot; filtering behaviour to a &quot;deny all unless instructed otherwise&quot; behaviour. <filter class=&quot; org.apache.log4j.varia.DenyAllFilter &quot;/> This filter drops all logging events.
  • 38.
  • 39.
  • 40.

Notas del editor

  1. Le nom du POJO correspond, par défaut, au nom de la table. Le nom des membres du POJO correspondent, par défaut, aux noms des champs de la table. @Id on peut spécifier une stratégie de génération de ID (default == non générée) - @GeneratedValue(strategy=GenerationType.AUTO) - @GeneratedValue(strategy=GenerationType.TABLE) - @GeneratedValue(strategy=GenerationType.SEQUENCE) - @GeneratedValue(strategy=GenerationType.IDENTITY)
  2. Par défaut, dans une relation, le join column sera formé de la sorte: &lt;source_relationship_name&gt;_&lt;target_pk_name&gt; Donc ici: D_ID
  3. Ici le propriétaire de la relation est Employee, c’est lui qui a la foreign key. Donc ParkingSpace a seulement besoin de spécifier sur quel champs la relation est mappé dans la classe propriétaire de la relation. Si la FK == PK, on peut utiliser @PrimaryKeyJoinColumn au lieu de @JoinColumn(name= …) Dans une relation bidirectionnelle, une seule des entité « possède » la relation. L’entité propriétaire de la relation est celle qui déclare la « join column ».
  4. Ici le propriétaire de la relation est Employee, c’est lui qui a la foreign key. Donc ParkingSpace a seulement besoin de spécifier sur quel champs la relation est mappé dans la classe propriétaire de la relation. Si la FK == PK, on peut utiliser @PrimaryKeyJoinColumn au lieu de @JoinColumn(name= …) Dans une relation bidirectionnelle, une seule des entité « possède » la relation. L’entité propriétaire de la relation est celle qui déclare la « join column ».