SlideShare a Scribd company logo
Planning and Managing Software Projects 2011-12



Logging frameworks

Emanuele Della Valle, Lecturer: Daniele Dell’Aglio
http://emanueledellavalle.org
Outline
    Logging framework
    Key concepts
          Declaration and Naming
          Levels
          Appenders
          Layouts
    Java logging frameworks
          Logging systems: Log4J, JUL, LogBack
          Logging systems façades: ACL, SLF4J




 Planning and Managing Software Projects – Emanuele Della Valle
Why a logging framework?
   System.out/err are not enough!
   Logging frameworks overcome the System.out/err
    limits
         Several importance levels for messages
         Use of different output systems (console, file, mail...)
         ...
   We will consider Log4J as logging framework (but the
    concepts are similar in other systems)




Planning and Managing Software Projects – Emanuele Della Valle
Example (example1 package)
...
public int sum(int a, int b){
               System.out.println(
                              "The input values are "+a+" and "+b);
               int ret = a+b;
               System.out.println("The sum is "+ret);
               return ret;
}

...




    Planning and Managing Software Projects – Emanuele Della Valle
Example
...
Logger logger = Logger.getLogger(Example.class);
public int sum(int a, int b){
               logger.info(
                              "The input values are "+a+" and "+b);
               //System.out.println(
                              "The input values are "+a+" and "+b);
               int ret = a+b;
               logger.info("The sum is "+ret);
               //System.out.println("The sum is "+ret);
               return ret;
}

...
    Planning and Managing Software Projects – Emanuele Della Valle
Declaration and Naming
   Loggers are initializated through a factory method
                      Logger x = Logger.getLogger("Logger1");

   The logger name is unique
         Two invocations of “Logger1” return the same logger
          object
   Usually logger are named with the name of the class
                  Logger x = Logger.getLogger(ClassX.class);

   Log4J builds and manages a tree of loggers
         Nodes and leaves are determined through logger names
         The root of the tree is called rootLogger
         The tree is a key concept for the management of the
          logger system (as we will see in the next slides)



Planning and Managing Software Projects – Emanuele Della Valle
Example (example2 package)


                                                                             rootLogger


                                                                                  pmsp


                                                                               logging


                                                                              example2


                                                                        p1                p2


Where each logger is declared as:
                                                                   Class1    s1          Class3
Logger classXLogger=
 Logger.getLogger(ClassX.class)
                                                                            Class2




  Planning and Managing Software Projects – Emanuele Della Valle
Levels
   While developing a system is useful to print out
    messages to check the correct behaviour of the
    application
   When the application is deployed most of those
    messages are not relevant
   Logging frameworks allow to define several levels of
    importance for the messages




Planning and Managing Software Projects – Emanuele Della Valle
Level hierarchy in Log4J



                                                                  FATAL

                                                                  ERROR

                                                                  WARN

                                                                  INFO

                                                                  DEBUG

                                                                  TRACE


 Planning and Managing Software Projects – Emanuele Della Valle
Meaning of the levels
 There are not strictly rules to verify if levels are used
  correctly
 Anyway the Log4j documentation indicates a general
  guide line:
      • FATAL: designates very severe error events that will
        presumably lead the application to abort.
      • ERROR: designates error events that might still allow
        the application to continue running.
      • WARN: The WARN level designates potentially harmful
        situations.
      • INFO: designates informational messages that highlight
        the progress of the application at coarse-grained
        level.
      • DEBUG: designates fine-grained informational events
        that are most useful to debug an application.
      • TRACE: designates finer-grained informational events
        than the DEBUG

 Planning and Managing Software Projects – Emanuele Della Valle
Configuring the levels
    Each logger has an assigned level. The level is
     assigned in to possible ways
    Explicit declaration: the level associated to a logger is
     declared:
          in the configuration file:
                            log4j.logger.<logger-name>=<level>
          or in the code:
                                logger.setLevel(Level.<level>);

    Implicit declaration: the level is inferred through the
     logger tree
                  Loggers inherit the level of their parents




 Planning and Managing Software Projects – Emanuele Della Valle
Example
 In the properties file:
log4j.rootlogger=INFO                                                    INFO    rootLogger


                                                                         INFO      pmsp


                                                                         INFO     logging


                                                                         INFO    example2


                                                                     INFO   p1                p2   INFO


                                                                  INFO Class1    s1 INFO Class3 INFO


                                                                        INFO Class2
                                                                                               Declared
                                                                                               Inferred

 Planning and Managing Software Projects – Emanuele Della Valle
Example
 In the properties file:
log4j.rootlogger=INFO                                                    INFO    rootLogger

log4j.logger.pmsp.logging.
                                                                         INFO      pmsp
            example2.p2.Class3=ERROR

                                                                         INFO     logging


                                                                         INFO    example2


                                                                     INFO   p1                p2   INFO


                                                                  INFO Class1    s1 INFO Class3 ERROR


                                                                        INFO Class2
                                                                                               Declared
                                                                                               Inferred

 Planning and Managing Software Projects – Emanuele Della Valle
Example
 In the properties file:
log4j.rootlogger=INFO                                                     INFO   rootLogger

log4j.logger.pmsp.logging.
                                                                          INFO     pmsp
            example2.p2.Class3=ERROR
log4j.logger.pmsp.logging.
                                                                          INFO    logging
            example2=DEBUG
                                                                          DEBUG example2


                                                                      DEBUG p1                p2   DEBUG


                                                                  DEBUG Class1   s1 DEBUGClass3 ERROR


                                                                        DEBUG Class2
                                                                                               Declared
                                                                                               Inferred

 Planning and Managing Software Projects – Emanuele Della Valle
Appenders
   Loggers can write on several output systems
   Each output system is defined by an appender
   There is a high number of available appenders in Log4J
         Console, File, DB, network, etc.
         Appenders are declared and configured in the properties
          file
                     log4j.appenders.<name>=<appender class>
                     log4j.appenders.<name>.<param1>=...
                     log4j.appenders.<name>.<param2>=...

   Each logger is associated to one or more appenders
         The assignment is managed through the logger tree (like
          the levels)




Planning and Managing Software Projects – Emanuele Della Valle
Example
#Rolling file appender: fileap
log4j.appender.fileap=org.apache.log4j.RollingFileAppender
log4j.appender.fileap.File=log.xml
log4j.appender.fileap.MaxFileSize=100KB


#Stdout appender: stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender


log4j.rootLogger=INFO,stdout
log4j.logger.psmp.logging.example2.p2.Class3=FATAL,fileap

(Class3 is associated to both stdout and fileap appenders)


More info is availabe in the Log4j documentation:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AppenderSkeleton.html
 Planning and Managing Software Projects – Emanuele Della Valle
Layouts
   Layouts defines the format of the log lines
   Each appender is related to one layout
              log4j.appender.<name>.layout=<layout class>
              log4j.appender.<name>.layout.<param1>=...
              log4j.appender.<name>.layout.<param2>=...

   Some layouts built-in in Log4J are:
         DateLayout
         HTMLLayout
         XMLLayout
         PatternLayout




Planning and Managing Software Projects – Emanuele Della Valle
Example
#Rolling file appender
log4j.appender.fileap=org.apache.log4j.RollingFileAppender
log4j.appender.fileap.File=log.xml
log4j.appender.fileap.MaxFileSize=100KB
log4j.appender.fileap.layout=
            org.apache.log4j.xml.XMLLayout
#Stdout appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=
            org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=
              %d [%t] %-5p %c - %m%n



 Planning and Managing Software Projects – Emanuele Della Valle
Logging frameworks in Java
   Log4J is not the only available logging framework for
    Java
   Other notable logging systems are:
         Java Util Logging: built-in in the Java framework, it can
          be used without including external libraries in the
          project. On the other hand, it has a complex level
          hierarchy and less features than Log4J
         LogBack: aims to be the succesor of Log4j. This
          framework is faster than Log4J and overcomes some of
          its limits




Planning and Managing Software Projects – Emanuele Della Valle
Logging façades
   It is considered a bad practice to create a strong
    dependance between the code and a specific logging
    framework
   The best practice is to use a logging façade that
    “wraps” the logging framework system
   The two most used systems in Java are
         Apache Commons Logging (formerly Jakarta Commons
          Logging)
         SLF4J




Planning and Managing Software Projects – Emanuele Della Valle
SLF4J
   SLF4J abstracts the logging concepts allowing users to
    decide what logging system use in their application
   SLF4J is “configured” at deploy time
         Developer should import the right libraries into the
          project
         Classpath must have at most one bridge library




Planning and Managing Software Projects – Emanuele Della Valle
SLF4J




From http://www.slf4j.org/manual.html
 Planning and Managing Software Projects – Emanuele Della Valle
SLF4J
   In huge projects several logger framework could be used
   In this case SLF4J allows to use migration libraries
      They bounds an existing logging framework into SLF4j




                      commons-logging.jar




                                                                 From: http://www.slf4j.org/legacy.html
Planning and Managing Software Projects – Emanuele Della Valle
SLF4J
   In huge projects several logger framework could be used
   In this case SLF4J allows to use migration libraries
      They bounds an existing logging framework into SLF4j




                                                                 From: http://www.slf4j.org/legacy.html
Planning and Managing Software Projects – Emanuele Della Valle
SLF4J
   In huge projects several logger framework could be used
   In this case SLF4J allows to use migration libraries
      They bounds an existing logging framework into SLF4j




                                                                 From: http://www.slf4j.org/legacy.html
Planning and Managing Software Projects – Emanuele Della Valle
References
   Don't Use System.out.println! Use Log4j -
    http://www.vipan.com/htdocs/log4jhelp.html
   Apache Log4J manual
    http://logging.apache.org/log4j/1.2/manual.html
   SLF4J manual http://www.slf4j.org/manual.html
   Think again before adopting the commons-logging API
    http://articles.qos.ch/thinkAgain.html
   Logging, which framework to choose? Log4j, Commons
    Logging, LogBack, SLF4J
    http://mike.vanvendeloo.net/2011/05/06/logging-
    which-framework-to-choose-log4j-commons-logging-
    logback-slf4j



Planning and Managing Software Projects – Emanuele Della Valle

More Related Content

XLS
2011 scinto schedule
DOCX
04
DOC
PPT
Coisas De D. Aurora
PDF
Wireless Promotions White Paper
PPTX
Mapa mental
PDF
NPWP&NPPKP ::: Formulir pendaftaran wp badan per20 2013
2011 scinto schedule
04
Coisas De D. Aurora
Wireless Promotions White Paper
Mapa mental
NPWP&NPPKP ::: Formulir pendaftaran wp badan per20 2013

Viewers also liked (10)

PPTX
Nelson ferraz. U II
PPT
Yeni microsoft power point sunusu
DOCX
Camino2
PDF
Suidoosterfees Project Overview
XLSX
Natalia y valentina 7 d
PPT
PDF
Mastering multi touch attribution
PPTX
Portafolio de evidencias lsas
PPT
Behavioral economics for shopper insights v final
PDF
Overcoming anti-nutritional factors by using enzymes
Nelson ferraz. U II
Yeni microsoft power point sunusu
Camino2
Suidoosterfees Project Overview
Natalia y valentina 7 d
Mastering multi touch attribution
Portafolio de evidencias lsas
Behavioral economics for shopper insights v final
Overcoming anti-nutritional factors by using enzymes
Ad

Similar to P&MSP2012 - Logging Frameworks (11)

PDF
Log4j in 8 slides
ODP
Logging with Logback in Scala
PDF
stackconf 2020 | Let’s Debug Django like pro by Sayantika Banik
PPT
Logging with Logback in Scala
PDF
Intro to Django Debugging & Building Insights
PPT
PDF
Rein_in_the_ability_of_log4j
DOCX
Logging in Python.docx
PPT
Log4j Logging Mechanism
PPTX
Python Programming Essentials - M27 - Logging module
Log4j in 8 slides
Logging with Logback in Scala
stackconf 2020 | Let’s Debug Django like pro by Sayantika Banik
Logging with Logback in Scala
Intro to Django Debugging & Building Insights
Rein_in_the_ability_of_log4j
Logging in Python.docx
Log4j Logging Mechanism
Python Programming Essentials - M27 - Logging module
Ad

More from Daniele Dell'Aglio (20)

PDF
Distributed stream consistency checking
PDF
On web stream processing
PDF
On a web of data streams
PDF
Triplewave: a step towards RDF Stream Processing on the Web
PDF
On unifying query languages for RDF streams
PDF
RSEP-QL: A Query Model to Capture Event Pattern Matching in RDF Stream Proces...
PDF
Summary of the Stream Reasoning workshop at ISWC 2016
PDF
On Unified Stream Reasoning
PDF
On Unified Stream Reasoning - The RDF Stream Processing realm
PDF
Querying the Web of Data with XSPARQL 1.1
PDF
Augmented Participation to Live Events through Social Network Content Enrichm...
PDF
An experience on empirical research about rdf stream
PDF
RDF Stream Processing Models (RSP2014)
PDF
A Survey of Temporal Extensions of Description Logics
PDF
IMaRS - Incremental Materialization for RDF Streams (SR4LD2013)
PDF
RDF Stream Processing Models (SR4LD2013)
PPTX
Ontology based top-k query answering over massive, heterogeneous, and dynamic...
PPTX
On correctness in RDF stream processor benchmarking
PPTX
An Ontological Formulation and an OPM profile for Causality in Planning Appli...
PDF
P&MSP2012 - Maven
Distributed stream consistency checking
On web stream processing
On a web of data streams
Triplewave: a step towards RDF Stream Processing on the Web
On unifying query languages for RDF streams
RSEP-QL: A Query Model to Capture Event Pattern Matching in RDF Stream Proces...
Summary of the Stream Reasoning workshop at ISWC 2016
On Unified Stream Reasoning
On Unified Stream Reasoning - The RDF Stream Processing realm
Querying the Web of Data with XSPARQL 1.1
Augmented Participation to Live Events through Social Network Content Enrichm...
An experience on empirical research about rdf stream
RDF Stream Processing Models (RSP2014)
A Survey of Temporal Extensions of Description Logics
IMaRS - Incremental Materialization for RDF Streams (SR4LD2013)
RDF Stream Processing Models (SR4LD2013)
Ontology based top-k query answering over massive, heterogeneous, and dynamic...
On correctness in RDF stream processor benchmarking
An Ontological Formulation and an OPM profile for Causality in Planning Appli...
P&MSP2012 - Maven

Recently uploaded (20)

PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Approach and Philosophy of On baking technology
PDF
August Patch Tuesday
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
DP Operators-handbook-extract for the Mautical Institute
Web App vs Mobile App What Should You Build First.pdf
TLE Review Electricity (Electricity).pptx
Encapsulation_ Review paper, used for researhc scholars
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Hindi spoken digit analysis for native and non-native speakers
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Zenith AI: Advanced Artificial Intelligence
Programs and apps: productivity, graphics, security and other tools
Assigned Numbers - 2025 - Bluetooth® Document
Group 1 Presentation -Planning and Decision Making .pptx
A comparative study of natural language inference in Swahili using monolingua...
Heart disease approach using modified random forest and particle swarm optimi...
WOOl fibre morphology and structure.pdf for textiles
gpt5_lecture_notes_comprehensive_20250812015547.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Approach and Philosophy of On baking technology
August Patch Tuesday
SOPHOS-XG Firewall Administrator PPT.pptx
cloud_computing_Infrastucture_as_cloud_p

P&MSP2012 - Logging Frameworks

  • 1. Planning and Managing Software Projects 2011-12 Logging frameworks Emanuele Della Valle, Lecturer: Daniele Dell’Aglio http://emanueledellavalle.org
  • 2. Outline  Logging framework  Key concepts  Declaration and Naming  Levels  Appenders  Layouts  Java logging frameworks  Logging systems: Log4J, JUL, LogBack  Logging systems façades: ACL, SLF4J Planning and Managing Software Projects – Emanuele Della Valle
  • 3. Why a logging framework?  System.out/err are not enough!  Logging frameworks overcome the System.out/err limits  Several importance levels for messages  Use of different output systems (console, file, mail...)  ...  We will consider Log4J as logging framework (but the concepts are similar in other systems) Planning and Managing Software Projects – Emanuele Della Valle
  • 4. Example (example1 package) ... public int sum(int a, int b){ System.out.println( "The input values are "+a+" and "+b); int ret = a+b; System.out.println("The sum is "+ret); return ret; } ... Planning and Managing Software Projects – Emanuele Della Valle
  • 5. Example ... Logger logger = Logger.getLogger(Example.class); public int sum(int a, int b){ logger.info( "The input values are "+a+" and "+b); //System.out.println( "The input values are "+a+" and "+b); int ret = a+b; logger.info("The sum is "+ret); //System.out.println("The sum is "+ret); return ret; } ... Planning and Managing Software Projects – Emanuele Della Valle
  • 6. Declaration and Naming  Loggers are initializated through a factory method Logger x = Logger.getLogger("Logger1");  The logger name is unique  Two invocations of “Logger1” return the same logger object  Usually logger are named with the name of the class Logger x = Logger.getLogger(ClassX.class);  Log4J builds and manages a tree of loggers  Nodes and leaves are determined through logger names  The root of the tree is called rootLogger  The tree is a key concept for the management of the logger system (as we will see in the next slides) Planning and Managing Software Projects – Emanuele Della Valle
  • 7. Example (example2 package) rootLogger pmsp logging example2 p1 p2 Where each logger is declared as: Class1 s1 Class3 Logger classXLogger= Logger.getLogger(ClassX.class) Class2 Planning and Managing Software Projects – Emanuele Della Valle
  • 8. Levels  While developing a system is useful to print out messages to check the correct behaviour of the application  When the application is deployed most of those messages are not relevant  Logging frameworks allow to define several levels of importance for the messages Planning and Managing Software Projects – Emanuele Della Valle
  • 9. Level hierarchy in Log4J FATAL ERROR WARN INFO DEBUG TRACE Planning and Managing Software Projects – Emanuele Della Valle
  • 10. Meaning of the levels  There are not strictly rules to verify if levels are used correctly  Anyway the Log4j documentation indicates a general guide line: • FATAL: designates very severe error events that will presumably lead the application to abort. • ERROR: designates error events that might still allow the application to continue running. • WARN: The WARN level designates potentially harmful situations. • INFO: designates informational messages that highlight the progress of the application at coarse-grained level. • DEBUG: designates fine-grained informational events that are most useful to debug an application. • TRACE: designates finer-grained informational events than the DEBUG Planning and Managing Software Projects – Emanuele Della Valle
  • 11. Configuring the levels  Each logger has an assigned level. The level is assigned in to possible ways  Explicit declaration: the level associated to a logger is declared:  in the configuration file: log4j.logger.<logger-name>=<level>  or in the code: logger.setLevel(Level.<level>);  Implicit declaration: the level is inferred through the logger tree  Loggers inherit the level of their parents Planning and Managing Software Projects – Emanuele Della Valle
  • 12. Example  In the properties file: log4j.rootlogger=INFO INFO rootLogger INFO pmsp INFO logging INFO example2 INFO p1 p2 INFO INFO Class1 s1 INFO Class3 INFO INFO Class2 Declared Inferred Planning and Managing Software Projects – Emanuele Della Valle
  • 13. Example  In the properties file: log4j.rootlogger=INFO INFO rootLogger log4j.logger.pmsp.logging. INFO pmsp example2.p2.Class3=ERROR INFO logging INFO example2 INFO p1 p2 INFO INFO Class1 s1 INFO Class3 ERROR INFO Class2 Declared Inferred Planning and Managing Software Projects – Emanuele Della Valle
  • 14. Example  In the properties file: log4j.rootlogger=INFO INFO rootLogger log4j.logger.pmsp.logging. INFO pmsp example2.p2.Class3=ERROR log4j.logger.pmsp.logging. INFO logging example2=DEBUG DEBUG example2 DEBUG p1 p2 DEBUG DEBUG Class1 s1 DEBUGClass3 ERROR DEBUG Class2 Declared Inferred Planning and Managing Software Projects – Emanuele Della Valle
  • 15. Appenders  Loggers can write on several output systems  Each output system is defined by an appender  There is a high number of available appenders in Log4J  Console, File, DB, network, etc.  Appenders are declared and configured in the properties file log4j.appenders.<name>=<appender class> log4j.appenders.<name>.<param1>=... log4j.appenders.<name>.<param2>=...  Each logger is associated to one or more appenders  The assignment is managed through the logger tree (like the levels) Planning and Managing Software Projects – Emanuele Della Valle
  • 16. Example #Rolling file appender: fileap log4j.appender.fileap=org.apache.log4j.RollingFileAppender log4j.appender.fileap.File=log.xml log4j.appender.fileap.MaxFileSize=100KB #Stdout appender: stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.rootLogger=INFO,stdout log4j.logger.psmp.logging.example2.p2.Class3=FATAL,fileap (Class3 is associated to both stdout and fileap appenders) More info is availabe in the Log4j documentation: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AppenderSkeleton.html Planning and Managing Software Projects – Emanuele Della Valle
  • 17. Layouts  Layouts defines the format of the log lines  Each appender is related to one layout log4j.appender.<name>.layout=<layout class> log4j.appender.<name>.layout.<param1>=... log4j.appender.<name>.layout.<param2>=...  Some layouts built-in in Log4J are:  DateLayout  HTMLLayout  XMLLayout  PatternLayout Planning and Managing Software Projects – Emanuele Della Valle
  • 18. Example #Rolling file appender log4j.appender.fileap=org.apache.log4j.RollingFileAppender log4j.appender.fileap.File=log.xml log4j.appender.fileap.MaxFileSize=100KB log4j.appender.fileap.layout= org.apache.log4j.xml.XMLLayout #Stdout appender log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout= org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern= %d [%t] %-5p %c - %m%n Planning and Managing Software Projects – Emanuele Della Valle
  • 19. Logging frameworks in Java  Log4J is not the only available logging framework for Java  Other notable logging systems are:  Java Util Logging: built-in in the Java framework, it can be used without including external libraries in the project. On the other hand, it has a complex level hierarchy and less features than Log4J  LogBack: aims to be the succesor of Log4j. This framework is faster than Log4J and overcomes some of its limits Planning and Managing Software Projects – Emanuele Della Valle
  • 20. Logging façades  It is considered a bad practice to create a strong dependance between the code and a specific logging framework  The best practice is to use a logging façade that “wraps” the logging framework system  The two most used systems in Java are  Apache Commons Logging (formerly Jakarta Commons Logging)  SLF4J Planning and Managing Software Projects – Emanuele Della Valle
  • 21. SLF4J  SLF4J abstracts the logging concepts allowing users to decide what logging system use in their application  SLF4J is “configured” at deploy time  Developer should import the right libraries into the project  Classpath must have at most one bridge library Planning and Managing Software Projects – Emanuele Della Valle
  • 22. SLF4J From http://www.slf4j.org/manual.html Planning and Managing Software Projects – Emanuele Della Valle
  • 23. SLF4J  In huge projects several logger framework could be used  In this case SLF4J allows to use migration libraries  They bounds an existing logging framework into SLF4j commons-logging.jar From: http://www.slf4j.org/legacy.html Planning and Managing Software Projects – Emanuele Della Valle
  • 24. SLF4J  In huge projects several logger framework could be used  In this case SLF4J allows to use migration libraries  They bounds an existing logging framework into SLF4j From: http://www.slf4j.org/legacy.html Planning and Managing Software Projects – Emanuele Della Valle
  • 25. SLF4J  In huge projects several logger framework could be used  In this case SLF4J allows to use migration libraries  They bounds an existing logging framework into SLF4j From: http://www.slf4j.org/legacy.html Planning and Managing Software Projects – Emanuele Della Valle
  • 26. References  Don't Use System.out.println! Use Log4j - http://www.vipan.com/htdocs/log4jhelp.html  Apache Log4J manual http://logging.apache.org/log4j/1.2/manual.html  SLF4J manual http://www.slf4j.org/manual.html  Think again before adopting the commons-logging API http://articles.qos.ch/thinkAgain.html  Logging, which framework to choose? Log4j, Commons Logging, LogBack, SLF4J http://mike.vanvendeloo.net/2011/05/06/logging- which-framework-to-choose-log4j-commons-logging- logback-slf4j Planning and Managing Software Projects – Emanuele Della Valle