SlideShare uma empresa Scribd logo
1 de 45
Baixar para ler offline
©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

Mais conteúdo relacionado

Semelhante a Application Logging for large systems

Real Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case StudyReal Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case Study
Nati Shalom
 
Make everything realtime & collaborative - JS Summit 2014
Make everything realtime & collaborative - JS Summit 2014Make everything realtime & collaborative - JS Summit 2014
Make everything realtime & collaborative - JS Summit 2014
Joseph Gentle
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
Peter Lubbers
 
Moving to the cloud azure, office365, and intune - concurrency
Moving to the cloud   azure, office365, and intune - concurrencyMoving to the cloud   azure, office365, and intune - concurrency
Moving to the cloud azure, office365, and intune - concurrency
Concurrency, Inc.
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
varien
 
Acc webinar deploying act! in a citrix environment
Acc webinar deploying act! in a citrix environmentAcc webinar deploying act! in a citrix environment
Acc webinar deploying act! in a citrix environment
Jon Klubnik
 
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT ProsSharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
Dan Usher
 
NSA for Enterprises Log Analysis Use Cases
NSA for Enterprises   Log Analysis Use Cases NSA for Enterprises   Log Analysis Use Cases
NSA for Enterprises Log Analysis Use Cases
WSO2
 

Semelhante a Application Logging for large systems (20)

Extending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with PluginsExtending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with Plugins
 
Desktop, Embedded and Mobile Apps with Vortex Café
Desktop, Embedded and Mobile Apps with Vortex CaféDesktop, Embedded and Mobile Apps with Vortex Café
Desktop, Embedded and Mobile Apps with Vortex Café
 
Desktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
Desktop, Embedded and Mobile Apps with PrismTech Vortex CafeDesktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
Desktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
 
Real Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case StudyReal Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case Study
 
Bp309
Bp309Bp309
Bp309
 
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP MeetupWeb Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
 
Make everything realtime & collaborative - JS Summit 2014
Make everything realtime & collaborative - JS Summit 2014Make everything realtime & collaborative - JS Summit 2014
Make everything realtime & collaborative - JS Summit 2014
 
The future will be Realtime & Collaborative
The future will be Realtime & CollaborativeThe future will be Realtime & Collaborative
The future will be Realtime & Collaborative
 
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
 
Moving to the cloud azure, office365, and intune - concurrency
Moving to the cloud   azure, office365, and intune - concurrencyMoving to the cloud   azure, office365, and intune - concurrency
Moving to the cloud azure, office365, and intune - concurrency
 
Saa s webinar slides final rlh - 3-31
Saa s webinar slides   final rlh - 3-31Saa s webinar slides   final rlh - 3-31
Saa s webinar slides final rlh - 3-31
 
Word on the Server
Word on the ServerWord on the Server
Word on the Server
 
Oracle Application Framework Cases
Oracle Application Framework Cases Oracle Application Framework Cases
Oracle Application Framework Cases
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
 
Intro to goldilocks inmemory db - low latency
Intro to goldilocks inmemory db - low latencyIntro to goldilocks inmemory db - low latency
Intro to goldilocks inmemory db - low latency
 
Acc webinar deploying act! in a citrix environment
Acc webinar deploying act! in a citrix environmentAcc webinar deploying act! in a citrix environment
Acc webinar deploying act! in a citrix environment
 
Breaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdfBreaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdf
 
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT ProsSharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
SharePoint Intersections - SP09 - Introduction to SharePoint 2013 for IT Pros
 
NSA for Enterprises Log Analysis Use Cases
NSA for Enterprises   Log Analysis Use Cases NSA for Enterprises   Log Analysis Use Cases
NSA for Enterprises Log Analysis Use Cases
 

Mais de Jane Prusakova

Mais de Jane Prusakova (20)

Software architecture houstontechfest2020
Software architecture houstontechfest2020Software architecture houstontechfest2020
Software architecture houstontechfest2020
 
Estimating software development
Estimating software developmentEstimating software development
Estimating software development
 
Better remote teams
Better remote teamsBetter remote teams
Better remote teams
 
Thoughts on building software architecture
Thoughts on building software architectureThoughts on building software architecture
Thoughts on building software architecture
 
Improving IT Performance
Improving IT PerformanceImproving IT Performance
Improving IT Performance
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
 
Questions of Ethics in Software Development
Questions of Ethics in Software DevelopmentQuestions of Ethics in Software Development
Questions of Ethics in Software Development
 
Just startcoding
Just startcodingJust startcoding
Just startcoding
 
Just start coding
Just start codingJust start coding
Just start coding
 
Managing remote teams.
Managing remote teams.Managing remote teams.
Managing remote teams.
 
Gender-neutral Recruiting
Gender-neutral RecruitingGender-neutral Recruiting
Gender-neutral Recruiting
 
Privacy In The Digital Age
Privacy In The Digital AgePrivacy In The Digital Age
Privacy In The Digital Age
 
Interview: a Learning Conversation
Interview: a Learning ConversationInterview: a Learning Conversation
Interview: a Learning Conversation
 
Effective Code Review
Effective Code ReviewEffective Code Review
Effective Code Review
 
Effective Code Review
Effective Code ReviewEffective Code Review
Effective Code Review
 
Lets talk about good code
Lets talk about good codeLets talk about good code
Lets talk about good code
 
Motivating Knowledge Workers
Motivating Knowledge WorkersMotivating Knowledge Workers
Motivating Knowledge Workers
 
What is good code?
What is good code?What is good code?
What is good code?
 
Pragmatic Agile: distributed teams
Pragmatic Agile: distributed teamsPragmatic Agile: distributed teams
Pragmatic Agile: distributed teams
 
A case for remote teams
A case for remote teamsA case for remote teams
A case for remote teams
 

Último

Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Último (20)

Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 

Application Logging for large systems