SlideShare una empresa de Scribd logo
1 de 44
APPLICATION LOGGING
About ME Sander De Vos Software Engineer RealDolmen 2008 Past projects MaTMa (M*) E-Metro (FOD-ECO) SP10B (FOD-FIN) MIK (FOD-MOB)
QuotesFrom The Field “Whoneeds logs? Isuredon’t!” “Debugger is better! Sysoutworkstoo!” “Isn’tthatwhatinfrastructure does?” “It slows down disk and memory!” “It isn’t in the spec!” “We don’tknowwhatto log – we’lljust log something!” “We don’tknowhow – we’lljust do itsomehow!”
Agenda What is logging Definition andChallenges Whylogging Whouses logs What logs are usedfor Functional or non-functional Whatto log Whatwill (not) help you Log messagedecomposed Guidelines How to log in Java Logging in production Log processing and analysis
What is logging
Definition “Logs are the recordings of one or more events occurring on information systems.” “Logs can be organized based on the program, day, severity, host, or a number of other categories.“ “Logs may be referred to as log files, audit logs, or audit trails. Logs also cover alerts, alarms and event records.“
Log challenges Decentralization Cloud SOA Volatility Multiple tiersandlayers Archival Accessability Absence of critical information Random log formats
WHY logging
Whouses logs Managed Services Security Teams Monitor Detect Investigate Track Analyze Auditors Developers Debugging Customer
What logs are usedfor Debugging andForensics Fault monitoring Performance monitoring Troubleshooting Feature usage Security / Incident detection Regulatoryand standards compliance
Functional – non-functionallogging Functional Audit Governance Security Non-functional Faults, Errors, Exceptions Execution context Performance Component usage
Putting italltogether Functional Logs CustomerAudit Always on Requirements Scope known Years ‘Clutter, yuck, slow’ Non-Functional Logs System operatorDeveloper Sometimes on Errors, Exceptions, Debug Scope notknown Hours, Days ‘Mightcome in handy’
WHAT to log
Keep in mind ”Whatwouldhelp YOU at 3 AM in the morning? “ Image: Ambro / FreeDigitalPhotos.net
Whatwillhelp you Exact notice of whathappened When Where How Who Clearconcise context information Analysis possible without application Manual Semi-automated Automated Remotelycollectible files Low footprint Proven reliableandauthentic
Whatwill help youexamples 2011-05-31 08:46:11,308 +0200 INFO  [eventlog.security]  ACCESS OF ProfileServiceImpl.findProfilesBY [login: some_username]; Password: [PROTECTED]; Authenticated: true; Details: RemoteIpAddress: 192.168.156.17; SessionId: 8XyrNkLWv7FdXS… Granted Authorities:ROLE_USER,ROLE…
Whatwon’thelp you No details about the record No context information Inconsistent format or bad use Non-correlatable Subjective/interpretativemessage Too muchuseless log records Loggingtoone single big file
Whatwon’t help you – example#1 log4j: setFile called: ./logs/be/mobistar/network-status/log_functional.log, false log4j: setFileended tis nendefault tis nendefault Activations : 15 Deactivations : 0 In straigt to resource filter
Whatwon’t help you – example#2 INFO  [dao.ProductDao] [] - FOUND 40 INFO  [web.listeners.PhaseLogger] [] - +RENDER_RESPONSE INFO [service.ProductFamilyService] [] - product in family is true INFO  [.dao.ProfileDao] [] - [OBJECTS] find profiles
log messagedecomposed
“A log record shouldbeunderstandableby a human, andeasily machine processable.”
LoggingGuidelines: Priorities Fatal Application crash&burn Error Exceptions Monitoring team alert Warn Monitor health, performance Info Informative Context Audit trail Debug Extensive Context Development, Testing Troubleshooting
LoggingGuidelines: Exceptions Handling Recover Log the details ifcritical Not Handling, Translating Translate Handling logic ifnotpropagating Not Handling Propagate Someoneelsewill handle (and log!) Chooseexceptionsto log Defendfromstacktrace chaos Choosewhatto log foreachexception Catching block has all context details!
LoggingGuidelines: Correlation 1 transaction = * log records Correlationnecessary Executiontrail Shared context variable Shared per transaction Reuse of context variables Nested Diagnostic Context Map Diagnostic Context Onlyonecorrelation Use a context uniquevariable Correlate transactions
How to log iN
How loggingframeworkswork
Java Logging Frameworks Implementation System.out – System.err Redirect output Java UtilLogging Log4j Logback Abstraction CommonsLogging SLF4J
Java UtilLogging Java 1.4+ Based on Log4J Less features out of the box Console File Stream
Log4j First framework Introductionof Logger, Appender, Level Hiearchical Loggers Configurableappenders, e.g. MailAppender FileAppender SMTPAppender SocketAppender SyslogAppender Leader quitandstartedlogback
CommonsLogging Apache Project API Bridge API-calls forward to Log4j if on CP Falls back to JUL Plagued Double Configuration Runtime dependency check ClasspathScanning Discontinued v1.1.1 dates from end 2007
Slf4j - Logback Twolibrariestorulethemall Slf4j Comparablewithcommons-logging Parameter parsing Framework  bridges Much more powerful Logback Evolved log4j Implements Slf4j “Picking up where log4j leaves off” Testing Filters on-need-base
SLF4J Binding
SLF4J Bridging
Keepingit performant String concatenation LOGGER.debug("Hello " + name); Protected block if (logger.isDebugEnabled()) {LOGGER.debug("Hello " + name);} Slf4j LOGGER.debug("Hello {}", name);
Context Variables In Practice NDC.push(correlationId); app.logMe("Hello world!"); NDC.pop(); Use %x in Pattern ConversionPattern= %x %d %m %n correlationId 2011-06-21 09:20:41 [INFO] Hello world!
Specialized Loggers Logger for class Fine-tune log Executiontrace How distinguish Security Performance  Business Specialized Loggers Priorities Output handlers Groupedlogging
Logging In Production Onlynecessarylogging Situation -> turn on debuglogging No restart: DynamicReloading ‘Watch’ file for changes Log file management Rolling file Seperation of concerns Clustering Different systems generatemessages Synchronization of timestamps Correlation on host-specific files
My Opinion Importance of loggingwillgrow Mobile / offline applications Cloud integration System interaction Logging standards enterprisewide Standardization of logging effort Inexpensiveexercise Draft a standard Build adapters / patterns Enforce standards
Log Processing and analysis
Log Analysis Bang foryourbuck XpoLog http://www.xpolog.com Licensed Faster Splunk http://www.splunk.com Free Edition ‘Slow’ AJAX feel Nice graphics Modular (http://www.splunkbase.com) Tuningyourpattern is important?
Demo
For more information: visit our website WWW.REALDOLMEN.COM Follow us on: Selected presentations are available on: Thank You Or scan this QR code with your Smartphone to immediately go to the website

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re GoingSpring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
 
Introducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using itIntroducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using it
 
Django vs flask
Django vs flaskDjango vs flask
Django vs flask
 
Omg bpmn tutorial
Omg bpmn tutorialOmg bpmn tutorial
Omg bpmn tutorial
 
RunDeck
RunDeckRunDeck
RunDeck
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloak
 
Airflow for Beginners
Airflow for BeginnersAirflow for Beginners
Airflow for Beginners
 
Data Pipline Observability meetup
Data Pipline Observability meetup Data Pipline Observability meetup
Data Pipline Observability meetup
 
Draft: building secure applications with keycloak (oidc/jwt)
Draft: building secure applications with keycloak (oidc/jwt)Draft: building secure applications with keycloak (oidc/jwt)
Draft: building secure applications with keycloak (oidc/jwt)
 
Modélisation de données pour MongoDB
Modélisation de données pour MongoDBModélisation de données pour MongoDB
Modélisation de données pour MongoDB
 
Intro to open source observability with grafana, prometheus, loki, and tempo(...
Intro to open source observability with grafana, prometheus, loki, and tempo(...Intro to open source observability with grafana, prometheus, loki, and tempo(...
Intro to open source observability with grafana, prometheus, loki, and tempo(...
 
apidays London 2022 - How innovators are driving growth from API strategies, ...
apidays London 2022 - How innovators are driving growth from API strategies, ...apidays London 2022 - How innovators are driving growth from API strategies, ...
apidays London 2022 - How innovators are driving growth from API strategies, ...
 
apidays Paris 2022 - Agile API delivery with Feature Toggles, Rafik Ferroukh,...
apidays Paris 2022 - Agile API delivery with Feature Toggles, Rafik Ferroukh,...apidays Paris 2022 - Agile API delivery with Feature Toggles, Rafik Ferroukh,...
apidays Paris 2022 - Agile API delivery with Feature Toggles, Rafik Ferroukh,...
 
Tutorial - Modern Real Time Streaming Architectures
Tutorial - Modern Real Time Streaming ArchitecturesTutorial - Modern Real Time Streaming Architectures
Tutorial - Modern Real Time Streaming Architectures
 
Introduction à BPMN 2.0 - Business Process Modeling Notation
Introduction à BPMN 2.0 - Business Process Modeling NotationIntroduction à BPMN 2.0 - Business Process Modeling Notation
Introduction à BPMN 2.0 - Business Process Modeling Notation
 
BPMN -The Very First Step in Business Continuity
BPMN -The Very First Step in Business ContinuityBPMN -The Very First Step in Business Continuity
BPMN -The Very First Step in Business Continuity
 
Machine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systemsMachine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systems
 
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
 
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
 
MuleSoft RPA for Beginners.pptx
MuleSoft RPA for Beginners.pptxMuleSoft RPA for Beginners.pptx
MuleSoft RPA for Beginners.pptx
 

Destacado

Spring Reference
Spring ReferenceSpring Reference
Spring Reference
Syed Shahul
 

Destacado (6)

Spring Reference
Spring ReferenceSpring Reference
Spring Reference
 
Java logging
Java loggingJava logging
Java logging
 
Log4j Logging Mechanism
Log4j Logging MechanismLog4j Logging Mechanism
Log4j Logging Mechanism
 
Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)
 
Elasticsearch, Logstash, Kibana. Cool search, analytics, data mining and more...
Elasticsearch, Logstash, Kibana. Cool search, analytics, data mining and more...Elasticsearch, Logstash, Kibana. Cool search, analytics, data mining and more...
Elasticsearch, Logstash, Kibana. Cool search, analytics, data mining and more...
 
Well logging
Well loggingWell logging
Well logging
 

Similar a Functional and non functional application logging

The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012
DefCamp
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
Axel Irriger
 

Similar a Functional and non functional application logging (20)

Application Logging Good Bad Ugly ... Beautiful?
Application Logging Good Bad Ugly ... Beautiful?Application Logging Good Bad Ugly ... Beautiful?
Application Logging Good Bad Ugly ... Beautiful?
 
Log Standards & Future Trends by Dr. Anton Chuvakin
Log Standards & Future Trends by Dr. Anton ChuvakinLog Standards & Future Trends by Dr. Anton Chuvakin
Log Standards & Future Trends by Dr. Anton Chuvakin
 
LogChaos: Challenges and Opportunities of Security Log Standardization
LogChaos: Challenges and Opportunities of Security Log StandardizationLogChaos: Challenges and Opportunities of Security Log Standardization
LogChaos: Challenges and Opportunities of Security Log Standardization
 
on log messages
on log messageson log messages
on log messages
 
MojoPortal And Log4net
MojoPortal And Log4netMojoPortal And Log4net
MojoPortal And Log4net
 
Six Mistakes of Log Management 2008
Six Mistakes of Log Management 2008Six Mistakes of Log Management 2008
Six Mistakes of Log Management 2008
 
The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012
 
From Monolith to Observable Microservices using DDD
From Monolith to Observable Microservices using DDDFrom Monolith to Observable Microservices using DDD
From Monolith to Observable Microservices using DDD
 
Technical Recruitment Overview & Tips
Technical Recruitment Overview & TipsTechnical Recruitment Overview & Tips
Technical Recruitment Overview & Tips
 
Oksana Safronova - Will you detect it or not? How to check if security team i...
Oksana Safronova - Will you detect it or not? How to check if security team i...Oksana Safronova - Will you detect it or not? How to check if security team i...
Oksana Safronova - Will you detect it or not? How to check if security team i...
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
 
How to Use OWASP Security Logging
How to Use OWASP Security LoggingHow to Use OWASP Security Logging
How to Use OWASP Security Logging
 
NIST 800-92 Log Management Guide in the Real World
NIST 800-92 Log Management Guide in the Real WorldNIST 800-92 Log Management Guide in the Real World
NIST 800-92 Log Management Guide in the Real World
 
Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")
 
Tooling on distributed services
Tooling on distributed servicesTooling on distributed services
Tooling on distributed services
 
Making Logs Sexy Again: Can We Finally Lose The Regexes?
Making Logs Sexy Again: Can We Finally Lose The Regexes?Making Logs Sexy Again: Can We Finally Lose The Regexes?
Making Logs Sexy Again: Can We Finally Lose The Regexes?
 
Service worker API
Service worker APIService worker API
Service worker API
 
Security Practices - Logging.pptx
Security Practices - Logging.pptxSecurity Practices - Logging.pptx
Security Practices - Logging.pptx
 
Log Management Systems
Log Management SystemsLog Management Systems
Log Management Systems
 
TDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit HappensTDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit Happens
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Functional and non functional application logging

  • 1.
  • 3. About ME Sander De Vos Software Engineer RealDolmen 2008 Past projects MaTMa (M*) E-Metro (FOD-ECO) SP10B (FOD-FIN) MIK (FOD-MOB)
  • 4. QuotesFrom The Field “Whoneeds logs? Isuredon’t!” “Debugger is better! Sysoutworkstoo!” “Isn’tthatwhatinfrastructure does?” “It slows down disk and memory!” “It isn’t in the spec!” “We don’tknowwhatto log – we’lljust log something!” “We don’tknowhow – we’lljust do itsomehow!”
  • 5. Agenda What is logging Definition andChallenges Whylogging Whouses logs What logs are usedfor Functional or non-functional Whatto log Whatwill (not) help you Log messagedecomposed Guidelines How to log in Java Logging in production Log processing and analysis
  • 7. Definition “Logs are the recordings of one or more events occurring on information systems.” “Logs can be organized based on the program, day, severity, host, or a number of other categories.“ “Logs may be referred to as log files, audit logs, or audit trails. Logs also cover alerts, alarms and event records.“
  • 8. Log challenges Decentralization Cloud SOA Volatility Multiple tiersandlayers Archival Accessability Absence of critical information Random log formats
  • 10. Whouses logs Managed Services Security Teams Monitor Detect Investigate Track Analyze Auditors Developers Debugging Customer
  • 11. What logs are usedfor Debugging andForensics Fault monitoring Performance monitoring Troubleshooting Feature usage Security / Incident detection Regulatoryand standards compliance
  • 12. Functional – non-functionallogging Functional Audit Governance Security Non-functional Faults, Errors, Exceptions Execution context Performance Component usage
  • 13. Putting italltogether Functional Logs CustomerAudit Always on Requirements Scope known Years ‘Clutter, yuck, slow’ Non-Functional Logs System operatorDeveloper Sometimes on Errors, Exceptions, Debug Scope notknown Hours, Days ‘Mightcome in handy’
  • 15. Keep in mind ”Whatwouldhelp YOU at 3 AM in the morning? “ Image: Ambro / FreeDigitalPhotos.net
  • 16. Whatwillhelp you Exact notice of whathappened When Where How Who Clearconcise context information Analysis possible without application Manual Semi-automated Automated Remotelycollectible files Low footprint Proven reliableandauthentic
  • 17. Whatwill help youexamples 2011-05-31 08:46:11,308 +0200 INFO [eventlog.security] ACCESS OF ProfileServiceImpl.findProfilesBY [login: some_username]; Password: [PROTECTED]; Authenticated: true; Details: RemoteIpAddress: 192.168.156.17; SessionId: 8XyrNkLWv7FdXS… Granted Authorities:ROLE_USER,ROLE…
  • 18. Whatwon’thelp you No details about the record No context information Inconsistent format or bad use Non-correlatable Subjective/interpretativemessage Too muchuseless log records Loggingtoone single big file
  • 19. Whatwon’t help you – example#1 log4j: setFile called: ./logs/be/mobistar/network-status/log_functional.log, false log4j: setFileended tis nendefault tis nendefault Activations : 15 Deactivations : 0 In straigt to resource filter
  • 20. Whatwon’t help you – example#2 INFO [dao.ProductDao] [] - FOUND 40 INFO [web.listeners.PhaseLogger] [] - +RENDER_RESPONSE INFO [service.ProductFamilyService] [] - product in family is true INFO [.dao.ProfileDao] [] - [OBJECTS] find profiles
  • 22. “A log record shouldbeunderstandableby a human, andeasily machine processable.”
  • 23. LoggingGuidelines: Priorities Fatal Application crash&burn Error Exceptions Monitoring team alert Warn Monitor health, performance Info Informative Context Audit trail Debug Extensive Context Development, Testing Troubleshooting
  • 24. LoggingGuidelines: Exceptions Handling Recover Log the details ifcritical Not Handling, Translating Translate Handling logic ifnotpropagating Not Handling Propagate Someoneelsewill handle (and log!) Chooseexceptionsto log Defendfromstacktrace chaos Choosewhatto log foreachexception Catching block has all context details!
  • 25. LoggingGuidelines: Correlation 1 transaction = * log records Correlationnecessary Executiontrail Shared context variable Shared per transaction Reuse of context variables Nested Diagnostic Context Map Diagnostic Context Onlyonecorrelation Use a context uniquevariable Correlate transactions
  • 28. Java Logging Frameworks Implementation System.out – System.err Redirect output Java UtilLogging Log4j Logback Abstraction CommonsLogging SLF4J
  • 29. Java UtilLogging Java 1.4+ Based on Log4J Less features out of the box Console File Stream
  • 30. Log4j First framework Introductionof Logger, Appender, Level Hiearchical Loggers Configurableappenders, e.g. MailAppender FileAppender SMTPAppender SocketAppender SyslogAppender Leader quitandstartedlogback
  • 31. CommonsLogging Apache Project API Bridge API-calls forward to Log4j if on CP Falls back to JUL Plagued Double Configuration Runtime dependency check ClasspathScanning Discontinued v1.1.1 dates from end 2007
  • 32. Slf4j - Logback Twolibrariestorulethemall Slf4j Comparablewithcommons-logging Parameter parsing Framework bridges Much more powerful Logback Evolved log4j Implements Slf4j “Picking up where log4j leaves off” Testing Filters on-need-base
  • 35. Keepingit performant String concatenation LOGGER.debug("Hello " + name); Protected block if (logger.isDebugEnabled()) {LOGGER.debug("Hello " + name);} Slf4j LOGGER.debug("Hello {}", name);
  • 36. Context Variables In Practice NDC.push(correlationId); app.logMe("Hello world!"); NDC.pop(); Use %x in Pattern ConversionPattern= %x %d %m %n correlationId 2011-06-21 09:20:41 [INFO] Hello world!
  • 37. Specialized Loggers Logger for class Fine-tune log Executiontrace How distinguish Security Performance Business Specialized Loggers Priorities Output handlers Groupedlogging
  • 38. Logging In Production Onlynecessarylogging Situation -> turn on debuglogging No restart: DynamicReloading ‘Watch’ file for changes Log file management Rolling file Seperation of concerns Clustering Different systems generatemessages Synchronization of timestamps Correlation on host-specific files
  • 39. My Opinion Importance of loggingwillgrow Mobile / offline applications Cloud integration System interaction Logging standards enterprisewide Standardization of logging effort Inexpensiveexercise Draft a standard Build adapters / patterns Enforce standards
  • 40. Log Processing and analysis
  • 41. Log Analysis Bang foryourbuck XpoLog http://www.xpolog.com Licensed Faster Splunk http://www.splunk.com Free Edition ‘Slow’ AJAX feel Nice graphics Modular (http://www.splunkbase.com) Tuningyourpattern is important?
  • 42. Demo
  • 43.
  • 44. For more information: visit our website WWW.REALDOLMEN.COM Follow us on: Selected presentations are available on: Thank You Or scan this QR code with your Smartphone to immediately go to the website