SlideShare a Scribd company logo
©2010 Improving Enterprises, Inc.
Logging For Fun and Profit
Jane Prusakova
Jane.Prusakova@ImprovingEnterprises.com
http://softwareandotherthings.blogspot.com
Improving Enterprises
Houston JUG
2014
©2010 Improving Enterprises, Inc.
Jane Prusakova
Hard-core developer
Data science geek
Dancer and photographer
©2010 Improving Enterprises, Inc.
Why
How-to
Using the results
So lets talk about logging…
©2010 Improving Enterprises, Inc.
Peek into the soul
Real setup
Real data
Real users
Real work
Dev environment
Happy path
Minimum load
Limited data
©2010 Improving Enterprises, Inc.
Inside the cloud
No programming-by-coincidence
Replaces debugging
Works on server
©2010 Improving Enterprises, Inc.
Logging [vs Debugging]
Set up once, always ready to use
Minimum disruption to the flow
Works locally and in the cloud
Faster data collection
Collected data is persisted
©2010 Improving Enterprises, Inc.
Logging helps with…
Integration
Multithreading
High load
©2010 Improving Enterprises, Inc.
What else?
Trace what the users do
Features
Sequences
Data flow
©2010 Improving Enterprises, Inc.
When to use logging?
New systems
New features
Bug fixing
©2010 Improving Enterprises, Inc.
Are logs forever?
Permanent
Errors
Extraordinary situations
©2010 Improving Enterprises, Inc.
Some are seasonal
Very temporary
Debugging info
Trace bug fixes
©2010 Improving Enterprises, Inc.
Others last awhile
Medium term
Data flow
Resource utilization
Optimization points
©2010 Improving Enterprises, Inc.
How-to
Using the results
©2010 Improving Enterprises, Inc.
Yes, I want to setup logging!
Pick a framework
Configure logging
Storage and access
Getting value from logs
©2010 Improving Enterprises, Inc.
Log4J SLF4J
Apache MIT license
Logging framework Logging facade
Configuration, log levels and categories,
rotate log files, thread-safe logging.
Support: online documentation, tutorials,
online forums.
©2010 Improving Enterprises, Inc.
Database Files
Easy to parse,
hard to evolve
Very hard to parse,
easy to change
Uses DB
connections
Requires FS
access
Can cause app
crash, loss of logs,
slow down app
Can fill up space
©2010 Improving Enterprises, Inc.
Where to write logs?
Console
File system
DB
Queue mechanisms
Combination
©2010 Improving Enterprises, Inc.
Logging configuration
Java properties-style
XML
Programmatically
Hard-coded
Takes preference
©2010 Improving Enterprises, Inc.
Log Message
What to log with the message
Importance level
Timestamp
Where in the code
Data being processed
System state info
©2010 Improving Enterprises, Inc.
Example layout
log4j.appender.stdout.layout.ConversionPattern=
%d %5p [%t] (%F:%L) - %m%n
- Date
- Log Level
- Thread name
- File and line (slow to retrieve)
©2010 Improving Enterprises, Inc.
Good log messages
Support code
Correctness
Readability
Performance
©2010 Improving Enterprises, Inc.
Better log messages
Relate to generating point
Code
Data
©2010 Improving Enterprises, Inc.
Best log messages
Are formatted for
Readability
Aggregation
©2010 Improving Enterprises, Inc.
Logging objects
.toString()
org.apache.commons.lang.builder.ToStringBuilder
log.info(myDataObject);
©2010 Improving Enterprises, Inc.
What to log
Input and output
Errors and exceptions
Computation results
Integration points
Thread rendezvous
©2010 Improving Enterprises, Inc.
Input and output
public int calculateCost(String user, Flight flight)
{
log.debug(“calculateCost: “ + user + “: “ +
flight);
int cost = … ;
… // cost calculation
log.debug((“calculateCost: cost for “ + user
+ “: “ + flight + “ = “ + cost);
return cost;
}
©2010 Improving Enterprises, Inc.
Errors and exceptions
// do dangerous work
result = DoDangerousWork(user, flight);
}
catch (Exception e)
{
log.error(“methodName: exception in
DoDangerousWork for “ + user + “: “ + flight, e);
// recover or re-throw
}
©2010 Improving Enterprises, Inc.
More
Log destination, parameters, outcomes
DB calls
SOAP calls
Wait time
Thread joins
Available memory
Memory-intensive operations
Intermediate calculation results
For complicated calculations
©2010 Improving Enterprises, Inc.
Avoid
Little information
… // step 1
logger.info(“did something - XXXX”);
… // step 2
logger.info(“did more work - YYYY”);
foreach (…) {
… // useful work
logger.info(“working hard”);
}
©2010 Improving Enterprises, Inc.
Avoid
Code cluttering
if (logger.isDebugEnabled()) {
logger.debug(“Show Views");
logger.debug("Address:n" +
view.getAddress());
logger.debug("Email:n" +
view.getEmail());
}
©2010 Improving Enterprises, Inc.
Watch for logging-caused bugs
Side effects
Logger.info(count++ + “: did something”);
Errors and exceptions
Logger.info(m.GetValue());
©2010 Improving Enterprises, Inc.
DRY principle applies
©2010 Improving Enterprises, Inc.
Growing, growing…
Naming conventions
Rotation
by size
by time
©2010 Improving Enterprises, Inc.
You’ve got logs!
Real-time access
Deal with space limitations
Warning: large datasets
©2010 Improving Enterprises, Inc.
Security
Absolutely
No Sensitive Data
©2010 Improving Enterprises, Inc.
Using the results
©2010 Improving Enterprises, Inc.
Learning from the logs
Never rely on eye-balling
WYS is not WYG
Distinguish common and
rare
©2010 Improving Enterprises, Inc.
Code and logs
©2010 Improving Enterprises, Inc.
Process log
Line by line
No need to load entire file
Aggregate events
Relate to time
©2010 Improving Enterprises, Inc.
Tools
Utilities
grep
sort
uniq
Scripting
Perl
Awk
sed
©2010 Improving Enterprises, Inc.
Learning from the logs
> grep userName myApplication-MMDDYYYY.log
> grep methodName myApplication-MMDDYYYY.log
> grep FATAL myApplication-MMDDYYYY.log
> tail -2000 myApplication-MMDDYYYY.log | grep Exception
©2010 Improving Enterprises, Inc.
Querying logs using Awk
GNU Awk www.gnu.org/software/gawk
Create histograms
Wait times
Number of calls
Exceptions per time period or per user
Compare and relate events
Exception stacks traces
Outcomes by caller or thread
©2010 Improving Enterprises, Inc.
AWK demo
Logs for the demo generously
provided by
http://42graphy.org/
©2010 Improving Enterprises, Inc.
Jane.Prusakova at ImprovingEnterprises.com
SoftwareAndOtherThings.blogspot.com
@jprusakova
Jane Prusakova
http://www.slideshare.net/jprusakova
©2010 Improving Enterprises, Inc.
Logging For Fun and Profit
Jane Prusakova
Jane.Prusakova@ImprovingEnterprises.com
http://softwareandotherthings.blogspot.com
Improving Enterprises
Houston JUG
2014

More Related Content

Similar to Application Logging for large systems (20)

PPT
19-reliabilitytesting.ppt
Anilteaser
 
PDF
Mining Development Knowledge to Understand and Support Software Logging Pract...
SAIL_QU
 
PDF
LOGGING FOR FUN, AND PROFIT
Informatics Summit
 
PDF
Un-broken Logging - Operability.io 2015 - Matthew Skelton
Skelton Thatcher Consulting Ltd
 
PDF
Un-broken logging - the foundation of software operability - Operability.io -...
Matthew Skelton
 
PPT
Application Logging Good Bad Ugly ... Beautiful?
Anton Chuvakin
 
PDF
Un-broken Logging - TechnologyUG - Leeds - Matthew Skelton
Skelton Thatcher Consulting Ltd
 
PDF
Opslogger: Operations code (should be) production quality too!
Sean Reilly
 
PDF
Helpful logging with Java
roskakori
 
PDF
Logging
James Hollingworth
 
PDF
Are logs a software engineer’s best friend? Yes -- follow these best practices
Geshan Manandhar
 
PPTX
Logging best practice in mule using logger component
Govind Mulinti
 
PDF
Day 2 05 - steve feldman - logging matters
Steve Feldman
 
PDF
How i learned to stop worrying and love the logs
Hanokh Aloni
 
PDF
Conditional Logging Considered Harmful - Sean Reilly
JAXLondon2014
 
PPTX
MojoPortal And Log4net
VerifiedAD.com
 
DOCX
JAVA LOGGING for JAVA APPLICATION PERFORMANCE
Rajendra Ladkat
 
PDF
10 Tips to improve your application logs
Vanessa Gomes
 
PDF
Let's reconsider about collecting logs. Plus, visiting elastic@Moutain View!
心 谷本
 
PDF
Sustainable Logging – SplunkLive! 2014
Paul Gilowey
 
19-reliabilitytesting.ppt
Anilteaser
 
Mining Development Knowledge to Understand and Support Software Logging Pract...
SAIL_QU
 
LOGGING FOR FUN, AND PROFIT
Informatics Summit
 
Un-broken Logging - Operability.io 2015 - Matthew Skelton
Skelton Thatcher Consulting Ltd
 
Un-broken logging - the foundation of software operability - Operability.io -...
Matthew Skelton
 
Application Logging Good Bad Ugly ... Beautiful?
Anton Chuvakin
 
Un-broken Logging - TechnologyUG - Leeds - Matthew Skelton
Skelton Thatcher Consulting Ltd
 
Opslogger: Operations code (should be) production quality too!
Sean Reilly
 
Helpful logging with Java
roskakori
 
Are logs a software engineer’s best friend? Yes -- follow these best practices
Geshan Manandhar
 
Logging best practice in mule using logger component
Govind Mulinti
 
Day 2 05 - steve feldman - logging matters
Steve Feldman
 
How i learned to stop worrying and love the logs
Hanokh Aloni
 
Conditional Logging Considered Harmful - Sean Reilly
JAXLondon2014
 
MojoPortal And Log4net
VerifiedAD.com
 
JAVA LOGGING for JAVA APPLICATION PERFORMANCE
Rajendra Ladkat
 
10 Tips to improve your application logs
Vanessa Gomes
 
Let's reconsider about collecting logs. Plus, visiting elastic@Moutain View!
心 谷本
 
Sustainable Logging – SplunkLive! 2014
Paul Gilowey
 

More from Jane Prusakova (20)

PPTX
Software architecture houstontechfest2020
Jane Prusakova
 
PPTX
Estimating software development
Jane Prusakova
 
PPTX
Better remote teams
Jane Prusakova
 
PPTX
Thoughts on building software architecture
Jane Prusakova
 
PPTX
Improving IT Performance
Jane Prusakova
 
PPTX
Agile Software Development
Jane Prusakova
 
PPTX
Questions of Ethics in Software Development
Jane Prusakova
 
PPTX
Just startcoding
Jane Prusakova
 
PPTX
Just start coding
Jane Prusakova
 
PPTX
Managing remote teams.
Jane Prusakova
 
PPTX
Gender-neutral Recruiting
Jane Prusakova
 
PPTX
Privacy In The Digital Age
Jane Prusakova
 
PPTX
Interview: a Learning Conversation
Jane Prusakova
 
PPTX
Effective Code Review
Jane Prusakova
 
PPTX
Effective Code Review
Jane Prusakova
 
PPTX
Lets talk about good code
Jane Prusakova
 
PPTX
Motivating Knowledge Workers
Jane Prusakova
 
PPTX
What is good code?
Jane Prusakova
 
PPTX
Pragmatic Agile: distributed teams
Jane Prusakova
 
PPTX
A case for remote teams
Jane Prusakova
 
Software architecture houstontechfest2020
Jane Prusakova
 
Estimating software development
Jane Prusakova
 
Better remote teams
Jane Prusakova
 
Thoughts on building software architecture
Jane Prusakova
 
Improving IT Performance
Jane Prusakova
 
Agile Software Development
Jane Prusakova
 
Questions of Ethics in Software Development
Jane Prusakova
 
Just startcoding
Jane Prusakova
 
Just start coding
Jane Prusakova
 
Managing remote teams.
Jane Prusakova
 
Gender-neutral Recruiting
Jane Prusakova
 
Privacy In The Digital Age
Jane Prusakova
 
Interview: a Learning Conversation
Jane Prusakova
 
Effective Code Review
Jane Prusakova
 
Effective Code Review
Jane Prusakova
 
Lets talk about good code
Jane Prusakova
 
Motivating Knowledge Workers
Jane Prusakova
 
What is good code?
Jane Prusakova
 
Pragmatic Agile: distributed teams
Jane Prusakova
 
A case for remote teams
Jane Prusakova
 
Ad

Recently uploaded (20)

PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Ad

Application Logging for large systems