jdd2014: working with logs - krzysztof otrębski

Post on 01-Jul-2015

72 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Most developers in their work have probably dealt with logging frameworks as nowadays almost any non-trivial application makes use of them. Although there exists a large number of logging frameworks that manage to get their job done right, it is still difficult to find a program that would help analyze the log files. Most of the time the developer ends up using popular tools like "grep | less". In this session I will briefly discuss: * how to organize logs * what is useful about logs * how to browse logs and what are the available tools * how to cope with legacy code.

TRANSCRIPT

Working with LogsKrzysztof Otrębski

Long time ago I used to…

Work with legacy code

Depend on logs as the main source ofinformation

http://www.thebrieflife.com/2013/02/24/the-sisyphean-challenge/

Divide and ConquerAn example webapplication

Application

WeatherTicketsHotels

DirectionsPayment

Requests/Responses

SOAP-XML

JSON

SOAP-XML

SOAP-XML

SOAP-XML

JSON

app.logweather.log

tickets.log

hotels.log

directions.log

payment.log

traffic.log

How to select logs onearly and late stagePreliminary log selection

Logging different components intoseparate files

Rolling files daily

‘On demand’ log selection

Adding class, thread, level, date to alog event

Message Diagnostic Context (MDC)

WeatherTicketsHotels

DirectionsPayment

User A

User B

log …

log …

log …

log …

log …

log …

log …

log …

log …

log …

Requests/Responses Application

Do the same for tests

TestClass1testMethod1-1testMethod1-2testMethod1-3

log…………….

log…………….

log…………….

log…………….

log…………….

log…………….

log…………….

log…….log…………….

TestClass2testMethod2-1testMethod2-2

testMethod2-3

log…………….

log…………….

log…………….

log…………….

log…………….

log…………….

log…………….

log…….log…………….

Huston, we have a problemMy application uses threads for parallel

computing

new Thread(new MyRunnable()).start() will passMDC

In some cases we lose control on threadcreation

•java.util.concurrent.Executors

Integration with IDE

Working with legacy codeWhat does the work with

legacy code look like?

Killing bugs!!

top related