Top Banner
WORLD OF LOGGING
42

World of Logging

Dec 26, 2014

Download

Technology

A talk I gave at the ApacheCon EU 2012. I explained on the Apache Logging project - who are we, what are we doing and what might happen in the future. As log4j 2.0 were currently in beta state, I lost some words on it too.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: World of Logging

WORLD OF LOGGING

Page 2: World of Logging

Christian Grobmeier

@grobmeierhttp://www.grobmeier.de

Page 3: World of Logging

Why should you log?

Page 4: World of Logging

T H E BIGGEST CHALLENGES W E H A V E a

Page 5: World of Logging

SPEED!

Page 6: World of Logging

Failsafe. Reliable.

Page 7: World of Logging

Compability.

Page 8: World of Logging

Taste.

Page 9: World of Logging

L o g g i n g with Duke Java

Page 10: World of Logging

Too much t a s t e . . . m a k e s headache!

Think on: log4j, logback, JUL,

TinyLog, AVSL

Page 11: World of Logging

Pills: slf4j & Commons Logging

Page 12: World of Logging

slf4j

Commons Logging

log4j 1

log4j 2logback JUL AVSL

Which pill?

Don‘t forget PAX!

Page 13: World of Logging

Integrates well with:slf4j

log4j 1.xCommons Logging

log4j 2.0 is the

future of log4j

Page 14: World of Logging

What makes

log4j 2.0better?

Page 15: World of Logging

Instead:if(logger.isDebugEnabled()) logger.info("Hi, " + u.getA() + “ “ + u.getB());

API++

Page 16: World of Logging

Instead:if(logger.isDebugEnabled()) logger.info("Hi, " + u.getA() + “ “ + u.getB());

Write:logger.info("Hi, {} {} ", u.getA(), u.getB());

API++

Page 17: World of Logging

Marker:

Marker SQL_MARKER = MarkerManager.getMarker("SQL");

logger.debug( SQL_MARKER, "SELECT * FROM {}", table);

Better Filter

Page 18: World of Logging

@Plugin(name = "Sandbox", type = "Core", elementType = "appender")

public class Mine extends AppenderBase {

private Mine(String name, Filter f) { super(name, f, null); } public void append(LogEvent e) { … }

Plugins

Page 19: World of Logging

@PluginFactorypublic static Mine create( @PluginAttr("name") String n, @PluginElement("filters") Filter f) { return new Mine(n, f);}

Plugins

Page 20: World of Logging

<appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm} %msg%n"/> </Console></appenders>

Configuration

Page 21: World of Logging

{ "configuration": … "appenders": { "Console": { "name": "STDOUT", "PatternLayout": { "pattern": "%m%n" } }, ...

Configuration

Page 22: World of Logging

ConfigurationReloading

<configuration monitorInterval="30">...</configuration>

Page 23: World of Logging

SPEED!

log4j 1.x

logback

log4j 2.x

Disabled 5

2386

2116

2314

Logging Performance in ns

Page 24: World of Logging

There is more

sweetness

Page 25: World of Logging

CHAINSAW

Page 26: World of Logging
Page 27: World of Logging

The story of

log4php

2004 2007 2009 2010

Page 28: World of Logging

What‘s with...

log4netlog4cxx

Page 29: World of Logging

The story of

log4php

Community

Page 30: World of Logging

Good times,

bad times

2000 2009 2010 2011

Page 31: World of Logging

We need your

HELP

Currently only 4 regular code contributors.

Page 32: World of Logging

But we

FIGHT!

6 Releases~750 Commits~600 dev Mails

in 2012 only!

Page 33: World of Logging

Seriously.Isn‘t logging just

BORING?

Page 34: World of Logging

Well.. . how do you log on your mobile/cloud apps?

Page 35: World of Logging

With new innovation, new logging challenges

come up.

Logging needs innovation too.Look at Apache Flume.

Page 36: World of Logging

Upcoming at the IncubatorGuice Components

Page 37: World of Logging

Instead:Logger logger = Logger.getLogger( „test“);

Page 38: World of Logging

Instead:Logger logger = Logger.getLogger( „test“);

Write:@InjectLoggerLogger logger;

Page 39: World of Logging

Remember: Logging is mission critical.

Don‘t go without.

Page 40: World of Logging

We are hiring!

use it!ask questions!

spread the love!send patches!

[email protected]

Page 41: World of Logging

Christian Grobmeier

@grobmeierhttp://www.grobmeier.de

Follow me, if you dare!

Thank you!

Page 42: World of Logging

Image CreditsEarth (Nasa)

Vulcano (Flickr: Martin Barland)Tiger (Flickr: TeryKats)

Gazelle (Flickr: fwooper)Golden Gate Bridge (Flickr: TimeLapseBlog.com)

Pens (Flickr: JD | Photography)Wineglass (Flickr: Willia4)

Headache (Flickr: Threephin)Pills (Dr. Michael Günther)

Wheelgear (Flickr: ralphbijker)Grapes (Flickr: RVWithTito)

Chainsaw (Flickr: Dave Hosford)Elephant (Flickr: Werner Vermaak)Haunted House (Flickr: barb_ar)SOS (Flickr: Daquella Manera)

Bathtime muscles (Flickr: mollypop)Yawning Animal (Flickr: robef)

Mobile (Flickr: twicepix)Clouds (Flickr: karindalziel)

Fight (Flickr: KellBailey)