SlideShare a Scribd company logo
(Conditional) Logging 
Considered Harmful 
JAX London 2014
About Me 
Sean Reilly 
@seanjreilly
Logging Is Not Harmful 
In fact, it’s often useful. 
Conditional logging is harmful.
What I Mean By 
“Conditional” 
• Many loggers, organised by class name 
• Many log levels: 
• SEVERE, ERROR, WARN, INFO, DEBUG, 
TRACE 
• SEVERE, WARNING, INFO, CONFIG, FINE, 
FINER, FINEST 
• ERROR, WARN, INFO, DEBUG, TRACE 
• Message only logged if log level is active for a logger
Conditional Logging 
Frameworks 
• log4j 
• java.util.logging 
• Logback 
• slf4j 
• commons logging
Why Developers Log This 
Way 
• “We can log everything in 
development and INFO in production” 
• “When something unexpected 
happens in production, we can 
increase the log level dynamically and 
get the extra information we need” 
• “It helps us debug while developing”
The Real Reason 
What other options are there?
Why Did We Decide To 
Use Something Else?
The Real Reason Why
A Poor Fit For Agile 
Development 
• Difficult to test 
• Bad OO practices 
• Not friendly with dependency injection 
• Not Spring/Guice/IoC Container compatible 
• Custom configuration files 
• Not refactor-friendly 
• Produces important (maybe) untested code
Who Should Logging Be 
For? 
Operations!
What About Developers? 
Developers should 
run unit tests in a 
debugger
What To Change? 
• Not just a change in libraries 
• Not just a change in pattern 
• Change the process! 
Log for operations, not 
developers
The New 
Process
What Most Teams Do Now 
• Developers add logging while working on other 
stories 
• Usually without much guidance 
• Hand off to operations at the end 
• Operations figures out how to monitor 
• This isn’t tested 
• This usually isn’t much of a feedback loop 
• When there is, it’s probably informal
A Better Process 
• Stories for logging in the 
backlog 
• The Operations team is the 
customer 
• Collaborate between ops and 
dev
A Sample Story 
“As operations, I want a log 
entry to be written when the 
application starts, so that I can 
determine how often this 
happens over a period of 
time”
Operations Deserves 
• To know exactly what 
messages can occur 
• What each message means 
• Exactly what they should do
Operations Deserves 
Sometimes this is 
“something completely 
unexpected has 
happened, and you should 
call the developers”.
The New 
Pattern
Enum Based Logging
Enum Based Logging 
• An enum of all log messages
Enum Based Logging 
• An enum of all log messages 
• Each enum value has a 
unique code
Enum Based Logging 
• An enum of all log messages 
• Each enum value has a 
unique code 
• Each enum value has a 
format string
Enum Based Logging 
• An enum of all log messages 
• Each enum value has a unique code 
• Each enum value has a format string 
• To log: provide an enum value and 
format string arguments
The Output 
2014-­‐04-­‐30T17:46:49Z,-­‐,GDS-­‐0000,Published 
42 
records 
2014-­‐04-­‐30T17:48:18Z,-­‐,GDS-­‐0000,Published 
64 
records 
2014-­‐04-­‐30T17:52:45Z,-­‐,GDS-­‐0006,Config 
file 
foo.conf 
not 
found
Code Sample
Open Source
The Library 
• Open source (Apache2) 
• Opinionated 
• Simple output, easy to read, easy to 
parse 
• Small, simple, no transitive dependencies 
• Java 8 required
Testability Features 
• Designed for testability 
• Special test double 
• Mock framework agnostic 
• Contract tests for your enums 
• OpsLogger instances always use 
injection
Unique Features 
• Can automatically generate 
documentation 
• Logrotate friendly 
• Easy to parse with logstash 
• Special stack trace handling
Project Status 
• Release Candidate 
• Production Quality Code, properly tested 
• Good feature set 
• Needs documentation 
• Use in a serious production project 
before version 1.0
Gradle Dependencies 
repositories 
{ 
jcenter() 
} 
dependencies 
{ 
compile 
“com.equalexperts:opslogger:0.1.0-­‐rc1" 
testCompile 
“com.equalexperts:opslogger-­‐support:0.1.0-­‐rc1" 
}
Maven Dependencies 
<dependency> 
<groupId>com.equalexperts</groupId> 
<artifactId>opslogger</artifactId> 
<version>0.1.0-­‐rc1</version> 
</dependency> 
<dependency> 
<groupId>com.equalexperts</groupId> 
<artifactId>opslogger-­‐support</artifactId> 
<version>0.1.0-­‐rc1</version> 
<scope>test</scope> 
</dependency>
Thanks!
Ad

More Related Content

What's hot (20)

JoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP IntroJoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP Intro
Simon Bennetts
 
Rebooting design in RavenDB
Rebooting design in RavenDBRebooting design in RavenDB
Rebooting design in RavenDB
Oren Eini
 
OWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP IntroOWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP Intro
Simon Bennetts
 
OWASP 2013 AppSec EU Hamburg - ZAP Innovations
OWASP 2013 AppSec EU Hamburg - ZAP InnovationsOWASP 2013 AppSec EU Hamburg - ZAP Innovations
OWASP 2013 AppSec EU Hamburg - ZAP Innovations
Simon Bennetts
 
Staying friendly with the gc
Staying friendly with the gcStaying friendly with the gc
Staying friendly with the gc
Oren Eini
 
BlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo TalkBlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo Talk
Simon Bennetts
 
JavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAPJavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAP
Simon Bennetts
 
ZAP @FOSSASIA2015
ZAP @FOSSASIA2015ZAP @FOSSASIA2015
ZAP @FOSSASIA2015
Sumanth Damarla
 
OWASP 2013 Limerick - ZAP: Whats even newer
OWASP 2013 Limerick - ZAP: Whats even newerOWASP 2013 Limerick - ZAP: Whats even newer
OWASP 2013 Limerick - ZAP: Whats even newer
Simon Bennetts
 
AllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CIAllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CI
Simon Bennetts
 
MPI, Erlang and the web
MPI, Erlang and the webMPI, Erlang and the web
MPI, Erlang and the web
Lenz Gschwendtner
 
Power shell v3 session1
Power shell v3   session1Power shell v3   session1
Power shell v3 session1
Vladimir Márquez
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014
Derek Collison
 
Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk
Simon Bennetts
 
Ansible API
Ansible APIAnsible API
Ansible API
tylerturk
 
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
gmaran23
 
OWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAPOWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAP
Simon Bennetts
 
Sentry (SF Python, Feb)
Sentry (SF Python, Feb)Sentry (SF Python, Feb)
Sentry (SF Python, Feb)
zeeg
 
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
DevOpsDays Tel Aviv
 
Devoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National PoliceDevoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National Police
Bert Jan Schrijver
 
JoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP IntroJoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP Intro
Simon Bennetts
 
Rebooting design in RavenDB
Rebooting design in RavenDBRebooting design in RavenDB
Rebooting design in RavenDB
Oren Eini
 
OWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP IntroOWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP Intro
Simon Bennetts
 
OWASP 2013 AppSec EU Hamburg - ZAP Innovations
OWASP 2013 AppSec EU Hamburg - ZAP InnovationsOWASP 2013 AppSec EU Hamburg - ZAP Innovations
OWASP 2013 AppSec EU Hamburg - ZAP Innovations
Simon Bennetts
 
Staying friendly with the gc
Staying friendly with the gcStaying friendly with the gc
Staying friendly with the gc
Oren Eini
 
BlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo TalkBlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo Talk
Simon Bennetts
 
JavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAPJavaOne 2014 Security Testing for Developers using OWASP ZAP
JavaOne 2014 Security Testing for Developers using OWASP ZAP
Simon Bennetts
 
OWASP 2013 Limerick - ZAP: Whats even newer
OWASP 2013 Limerick - ZAP: Whats even newerOWASP 2013 Limerick - ZAP: Whats even newer
OWASP 2013 Limerick - ZAP: Whats even newer
Simon Bennetts
 
AllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CIAllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CI
Simon Bennetts
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014
Derek Collison
 
Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk
Simon Bennetts
 
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
gmaran23
 
OWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAPOWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAP
Simon Bennetts
 
Sentry (SF Python, Feb)
Sentry (SF Python, Feb)Sentry (SF Python, Feb)
Sentry (SF Python, Feb)
zeeg
 
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
Scaling Humans - BigPanda's Fabulous ChatOps Adventure - Erik Zaadi, BigPanda...
DevOpsDays Tel Aviv
 
Devoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National PoliceDevoxx PL 2018 - Microservices in action at the Dutch National Police
Devoxx PL 2018 - Microservices in action at the Dutch National Police
Bert Jan Schrijver
 

Similar to Conditional Logging Considered Harmful - Sean Reilly (20)

Opslogger: Operations code (should be) production quality too!
Opslogger: Operations code (should be) production quality too!Opslogger: Operations code (should be) production quality too!
Opslogger: Operations code (should be) production quality too!
Sean Reilly
 
FireBug And FirePHP
FireBug And FirePHPFireBug And FirePHP
FireBug And FirePHP
David Stockton
 
Functionality, security and performance monitoring of web assets (e.g. Joomla...
Functionality, security and performance monitoring of web assets (e.g. Joomla...Functionality, security and performance monitoring of web assets (e.g. Joomla...
Functionality, security and performance monitoring of web assets (e.g. Joomla...
Sanjay Willie
 
Java Logging
Java LoggingJava Logging
Java Logging
Zeeshan Bilal
 
Enterprise PHP
Enterprise PHPEnterprise PHP
Enterprise PHP
Mohammad Emran Hasan
 
Log4e
Log4eLog4e
Log4e
Gagandeep Singh
 
Redundant devops
Redundant devopsRedundant devops
Redundant devops
Szabolcs Szabolcsi-Tóth
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systems
Bill Buchan
 
Logging Application Behavior to MongoDB
Logging Application Behavior to MongoDBLogging Application Behavior to MongoDB
Logging Application Behavior to MongoDB
Robert Stewart
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
Hannes Lowette
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
Tomas Doran
 
Ansible Best Practices - July 30
Ansible Best Practices - July 30Ansible Best Practices - July 30
Ansible Best Practices - July 30
tylerturk
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
Mike Willbanks
 
Make It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version ControlMake It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version Control
indiver
 
Putting Compilers to Work
Putting Compilers to WorkPutting Compilers to Work
Putting Compilers to Work
SingleStore
 
Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")
Nicholas Roberts
 
Finding Needles in Haystacks
Finding Needles in HaystacksFinding Needles in Haystacks
Finding Needles in Haystacks
snyff
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"
Paolo Negri
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social games
Wooga
 
All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?
Christopher Read
 
Opslogger: Operations code (should be) production quality too!
Opslogger: Operations code (should be) production quality too!Opslogger: Operations code (should be) production quality too!
Opslogger: Operations code (should be) production quality too!
Sean Reilly
 
Functionality, security and performance monitoring of web assets (e.g. Joomla...
Functionality, security and performance monitoring of web assets (e.g. Joomla...Functionality, security and performance monitoring of web assets (e.g. Joomla...
Functionality, security and performance monitoring of web assets (e.g. Joomla...
Sanjay Willie
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systems
Bill Buchan
 
Logging Application Behavior to MongoDB
Logging Application Behavior to MongoDBLogging Application Behavior to MongoDB
Logging Application Behavior to MongoDB
Robert Stewart
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
Hannes Lowette
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
Tomas Doran
 
Ansible Best Practices - July 30
Ansible Best Practices - July 30Ansible Best Practices - July 30
Ansible Best Practices - July 30
tylerturk
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
Mike Willbanks
 
Make It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version ControlMake It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version Control
indiver
 
Putting Compilers to Work
Putting Compilers to WorkPutting Compilers to Work
Putting Compilers to Work
SingleStore
 
Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")
Nicholas Roberts
 
Finding Needles in Haystacks
Finding Needles in HaystacksFinding Needles in Haystacks
Finding Needles in Haystacks
snyff
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"
Paolo Negri
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social games
Wooga
 
All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?
Christopher Read
 
Ad

More from JAXLondon2014 (20)

GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita IvanovGridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
JAXLondon2014
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
JAXLondon2014
 
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
JAXLondon2014
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
JAXLondon2014
 
API Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul FremantleAPI Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul Fremantle
JAXLondon2014
 
'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long
JAXLondon2014
 
The Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongThe Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh Long
JAXLondon2014
 
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim RemaniThe Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
JAXLondon2014
 
Dataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel WinderDataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel Winder
JAXLondon2014
 
Habits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn VerburgHabits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn Verburg
JAXLondon2014
 
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly CumminsThe Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
JAXLondon2014
 
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris GollopTesting within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
JAXLondon2014
 
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
JAXLondon2014
 
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad MalikovSqueezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
JAXLondon2014
 
Spocktacular Testing - Russel Winder
Spocktacular Testing - Russel WinderSpocktacular Testing - Russel Winder
Spocktacular Testing - Russel Winder
JAXLondon2014
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David Delabassee
JAXLondon2014
 
Reflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz KabutzReflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz Kabutz
JAXLondon2014
 
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha GeeRapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
JAXLondon2014
 
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
JAXLondon2014
 
Personal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes ThönesPersonal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes Thönes
JAXLondon2014
 
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita IvanovGridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
JAXLondon2014
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
JAXLondon2014
 
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
JAXLondon2014
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
JAXLondon2014
 
API Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul FremantleAPI Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul Fremantle
JAXLondon2014
 
'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long
JAXLondon2014
 
The Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongThe Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh Long
JAXLondon2014
 
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim RemaniThe Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
JAXLondon2014
 
Dataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel WinderDataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel Winder
JAXLondon2014
 
Habits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn VerburgHabits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn Verburg
JAXLondon2014
 
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly CumminsThe Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
JAXLondon2014
 
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris GollopTesting within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
JAXLondon2014
 
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
JAXLondon2014
 
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad MalikovSqueezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
JAXLondon2014
 
Spocktacular Testing - Russel Winder
Spocktacular Testing - Russel WinderSpocktacular Testing - Russel Winder
Spocktacular Testing - Russel Winder
JAXLondon2014
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David Delabassee
JAXLondon2014
 
Reflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz KabutzReflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz Kabutz
JAXLondon2014
 
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha GeeRapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
JAXLondon2014
 
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
JAXLondon2014
 
Personal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes ThönesPersonal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes Thönes
JAXLondon2014
 
Ad

Recently uploaded (20)

Cross-Cultural-Communication-and-Adaptation.pdf
Cross-Cultural-Communication-and-Adaptation.pdfCross-Cultural-Communication-and-Adaptation.pdf
Cross-Cultural-Communication-and-Adaptation.pdf
rash64487
 
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
NETWAYS
 
A Brief Introduction About John Smith
A Brief Introduction About John SmithA Brief Introduction About John Smith
A Brief Introduction About John Smith
John Smith
 
The Mettle of Honor 05.11.2025.pptx
The  Mettle  of  Honor   05.11.2025.pptxThe  Mettle  of  Honor   05.11.2025.pptx
The Mettle of Honor 05.11.2025.pptx
FamilyWorshipCenterD
 
All_India_Situation_Presentation. by Dr Jesmina Khatun
All_India_Situation_Presentation. by Dr Jesmina KhatunAll_India_Situation_Presentation. by Dr Jesmina Khatun
All_India_Situation_Presentation. by Dr Jesmina Khatun
DRJESMINAKHATUN
 
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
NETWAYS
 
Seasonality_Mediterranean_Cuisine.pptx. Seasonality and Popularity of Medite...
Seasonality_Mediterranean_Cuisine.pptx.  Seasonality and Popularity of Medite...Seasonality_Mediterranean_Cuisine.pptx.  Seasonality and Popularity of Medite...
Seasonality_Mediterranean_Cuisine.pptx. Seasonality and Popularity of Medite...
graycil350
 
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
NETWAYS
 
Mastering Public Speaking: Key Skills for Confident Communication
Mastering Public Speaking: Key Skills for Confident CommunicationMastering Public Speaking: Key Skills for Confident Communication
Mastering Public Speaking: Key Skills for Confident Communication
karthikeyans20012004
 
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdfThe history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
wolfryx99
 
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
NETWAYS
 
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdfPRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
santomsalpurchasing
 
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdfHurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
wolfryx99
 
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
NETWAYS
 
NL-based Software Engineering (NLBSE) '25
NL-based Software Engineering (NLBSE) '25NL-based Software Engineering (NLBSE) '25
NL-based Software Engineering (NLBSE) '25
Sebastiano Panichella
 
criminal law kajsgdasn cakjsbciaYSVC aschaios
criminal law kajsgdasn cakjsbciaYSVC aschaioscriminal law kajsgdasn cakjsbciaYSVC aschaios
criminal law kajsgdasn cakjsbciaYSVC aschaios
eleazaranghel023
 
stackconf 2025 | How Open Source Communities are Defining the Next Generation...
stackconf 2025 | How Open Source Communities are Defining the Next Generation...stackconf 2025 | How Open Source Communities are Defining the Next Generation...
stackconf 2025 | How Open Source Communities are Defining the Next Generation...
NETWAYS
 
Modernization of Parliaments: The Way Forward
Modernization of Parliaments: The Way ForwardModernization of Parliaments: The Way Forward
Modernization of Parliaments: The Way Forward
Dr. Fotios Fitsilis
 
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
NETWAYS
 
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdfstackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
NETWAYS
 
Cross-Cultural-Communication-and-Adaptation.pdf
Cross-Cultural-Communication-and-Adaptation.pdfCross-Cultural-Communication-and-Adaptation.pdf
Cross-Cultural-Communication-and-Adaptation.pdf
rash64487
 
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
stackconf 2025 | From SBOM to Software Architecture Documentation by Philip A...
NETWAYS
 
A Brief Introduction About John Smith
A Brief Introduction About John SmithA Brief Introduction About John Smith
A Brief Introduction About John Smith
John Smith
 
The Mettle of Honor 05.11.2025.pptx
The  Mettle  of  Honor   05.11.2025.pptxThe  Mettle  of  Honor   05.11.2025.pptx
The Mettle of Honor 05.11.2025.pptx
FamilyWorshipCenterD
 
All_India_Situation_Presentation. by Dr Jesmina Khatun
All_India_Situation_Presentation. by Dr Jesmina KhatunAll_India_Situation_Presentation. by Dr Jesmina Khatun
All_India_Situation_Presentation. by Dr Jesmina Khatun
DRJESMINAKHATUN
 
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
stackconf 2025 | Building high-performance apps & controlling costs with CNCF...
NETWAYS
 
Seasonality_Mediterranean_Cuisine.pptx. Seasonality and Popularity of Medite...
Seasonality_Mediterranean_Cuisine.pptx.  Seasonality and Popularity of Medite...Seasonality_Mediterranean_Cuisine.pptx.  Seasonality and Popularity of Medite...
Seasonality_Mediterranean_Cuisine.pptx. Seasonality and Popularity of Medite...
graycil350
 
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
stackconf 2025 | Hot Off The Press: The Local-First Landscape by Miloš Sutano...
NETWAYS
 
Mastering Public Speaking: Key Skills for Confident Communication
Mastering Public Speaking: Key Skills for Confident CommunicationMastering Public Speaking: Key Skills for Confident Communication
Mastering Public Speaking: Key Skills for Confident Communication
karthikeyans20012004
 
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdfThe history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
The history of Human Rights powerpoint Andrea Giuliano Nacuzi.pdf
wolfryx99
 
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
stackconf 2025 | IP Authentication: A Tale of Performance Pitfalls and Challe...
NETWAYS
 
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdfPRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
PRESENTATION ASESSMENT LOGISTIK SITE JABATAN.pdf
santomsalpurchasing
 
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdfHurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
Hurricane Milton powerpoint Andrea Giuliano Nacuzi.pdf
wolfryx99
 
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
stackconf 2025 | Integrating generative AI into API Platform: Good idea? by L...
NETWAYS
 
NL-based Software Engineering (NLBSE) '25
NL-based Software Engineering (NLBSE) '25NL-based Software Engineering (NLBSE) '25
NL-based Software Engineering (NLBSE) '25
Sebastiano Panichella
 
criminal law kajsgdasn cakjsbciaYSVC aschaios
criminal law kajsgdasn cakjsbciaYSVC aschaioscriminal law kajsgdasn cakjsbciaYSVC aschaios
criminal law kajsgdasn cakjsbciaYSVC aschaios
eleazaranghel023
 
stackconf 2025 | How Open Source Communities are Defining the Next Generation...
stackconf 2025 | How Open Source Communities are Defining the Next Generation...stackconf 2025 | How Open Source Communities are Defining the Next Generation...
stackconf 2025 | How Open Source Communities are Defining the Next Generation...
NETWAYS
 
Modernization of Parliaments: The Way Forward
Modernization of Parliaments: The Way ForwardModernization of Parliaments: The Way Forward
Modernization of Parliaments: The Way Forward
Dr. Fotios Fitsilis
 
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
stackconf 2025 | 2025: I Don’t Know K8S and at This Point, I’m Too Afraid To ...
NETWAYS
 
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdfstackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
stackconf 2025 | Operator All the (stateful) Things by Jannik Clausen.pdf
NETWAYS
 

Conditional Logging Considered Harmful - Sean Reilly

  • 1. (Conditional) Logging Considered Harmful JAX London 2014
  • 2. About Me Sean Reilly @seanjreilly
  • 3. Logging Is Not Harmful In fact, it’s often useful. Conditional logging is harmful.
  • 4. What I Mean By “Conditional” • Many loggers, organised by class name • Many log levels: • SEVERE, ERROR, WARN, INFO, DEBUG, TRACE • SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST • ERROR, WARN, INFO, DEBUG, TRACE • Message only logged if log level is active for a logger
  • 5. Conditional Logging Frameworks • log4j • java.util.logging • Logback • slf4j • commons logging
  • 6. Why Developers Log This Way • “We can log everything in development and INFO in production” • “When something unexpected happens in production, we can increase the log level dynamically and get the extra information we need” • “It helps us debug while developing”
  • 7. The Real Reason What other options are there?
  • 8. Why Did We Decide To Use Something Else?
  • 10. A Poor Fit For Agile Development • Difficult to test • Bad OO practices • Not friendly with dependency injection • Not Spring/Guice/IoC Container compatible • Custom configuration files • Not refactor-friendly • Produces important (maybe) untested code
  • 11. Who Should Logging Be For? Operations!
  • 12. What About Developers? Developers should run unit tests in a debugger
  • 13. What To Change? • Not just a change in libraries • Not just a change in pattern • Change the process! Log for operations, not developers
  • 15. What Most Teams Do Now • Developers add logging while working on other stories • Usually without much guidance • Hand off to operations at the end • Operations figures out how to monitor • This isn’t tested • This usually isn’t much of a feedback loop • When there is, it’s probably informal
  • 16. A Better Process • Stories for logging in the backlog • The Operations team is the customer • Collaborate between ops and dev
  • 17. A Sample Story “As operations, I want a log entry to be written when the application starts, so that I can determine how often this happens over a period of time”
  • 18. Operations Deserves • To know exactly what messages can occur • What each message means • Exactly what they should do
  • 19. Operations Deserves Sometimes this is “something completely unexpected has happened, and you should call the developers”.
  • 22. Enum Based Logging • An enum of all log messages
  • 23. Enum Based Logging • An enum of all log messages • Each enum value has a unique code
  • 24. Enum Based Logging • An enum of all log messages • Each enum value has a unique code • Each enum value has a format string
  • 25. Enum Based Logging • An enum of all log messages • Each enum value has a unique code • Each enum value has a format string • To log: provide an enum value and format string arguments
  • 26. The Output 2014-­‐04-­‐30T17:46:49Z,-­‐,GDS-­‐0000,Published 42 records 2014-­‐04-­‐30T17:48:18Z,-­‐,GDS-­‐0000,Published 64 records 2014-­‐04-­‐30T17:52:45Z,-­‐,GDS-­‐0006,Config file foo.conf not found
  • 29. The Library • Open source (Apache2) • Opinionated • Simple output, easy to read, easy to parse • Small, simple, no transitive dependencies • Java 8 required
  • 30. Testability Features • Designed for testability • Special test double • Mock framework agnostic • Contract tests for your enums • OpsLogger instances always use injection
  • 31. Unique Features • Can automatically generate documentation • Logrotate friendly • Easy to parse with logstash • Special stack trace handling
  • 32. Project Status • Release Candidate • Production Quality Code, properly tested • Good feature set • Needs documentation • Use in a serious production project before version 1.0
  • 33. Gradle Dependencies repositories { jcenter() } dependencies { compile “com.equalexperts:opslogger:0.1.0-­‐rc1" testCompile “com.equalexperts:opslogger-­‐support:0.1.0-­‐rc1" }
  • 34. Maven Dependencies <dependency> <groupId>com.equalexperts</groupId> <artifactId>opslogger</artifactId> <version>0.1.0-­‐rc1</version> </dependency> <dependency> <groupId>com.equalexperts</groupId> <artifactId>opslogger-­‐support</artifactId> <version>0.1.0-­‐rc1</version> <scope>test</scope> </dependency>
  翻译: