Slide 1

Slide 1 text

Apache Log4j 2

Slide 2

Slide 2 text

Christian Grobmeier @grobmeier http://www.grobmeier.de ASF V. P. Logging Services

Slide 3

Slide 3 text

http://www.leanpub.com/thezenprogrammer/c/linz

Slide 4

Slide 4 text

(hopefully) soon: www.understandinglog4j.com

Slide 5

Slide 5 text

Why should you log?

Slide 6

Slide 6 text

ASF FIRE BRIGADE

Slide 7

Slide 7 text

Log4j1, Log4j2 log4php Chainsaw log4net log4cxx

Slide 8

Slide 8 text

How do you log?

Slide 9

Slide 9 text

We are stable! Log4j 2.1

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

CHALLENGES

Slide 12

Slide 12 text

SPEED!

Slide 13

Slide 13 text

Failsafe. Reliable.

Slide 14

Slide 14 text

Compability.

Slide 15

Slide 15 text

Taste.

Slide 16

Slide 16 text

L o g g i n g with Duke

Slide 17

Slide 17 text

Too much t a s t e . . . m a k e s headache! Think on: log4j, logback, JUL, TinyLog, AVSL

Slide 18

Slide 18 text

Pills: Some Abstraction Layers

Slide 19

Slide 19 text

Commons Logging log4j 1 log4j 2 logback JUL Which pill?

Slide 20

Slide 20 text

slf4j Commons Logging log4j 1 log4j 2 logback JUL AVSL Which pill?

Slide 21

Slide 21 text

slf4j Commons Logging log4j 1 log4j 2 logback JUL AVSL New kids on the block log4j 2

Slide 22

Slide 22 text

log4j 2.x is the future of log4j

Slide 23

Slide 23 text

New in log4j 2.x

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

Marker: Marker SQL_MARKER = MarkerManager.getMarker("SQL"); logger.debug( SQL_MARKER, "SELECT * FROM {}", table); Better Filter

Slide 26

Slide 26 text

@Plugin(name = "Mine", 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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

Configuration

Slide 29

Slide 29 text

%d %C{1.} Configuration

Slide 30

Slide 30 text

%d $${jndi:logging/context-name} %m%n Configuration

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

Configuration Reloading ...

Slide 33

Slide 33 text

More? MDC (ThreadContext) EventLogger Flowtracing …

Slide 34

Slide 34 text

SPEED! log4j 1.x logback log4j 2.x Disabled 5 2386 2116 2314 Logging Performance in ns

Slide 35

Slide 35 text

SPEED! Async Logging Power!

Slide 36

Slide 36 text

Again: >18,000,000 messages / second On Solaris 10 (64bit) with JDK1.7.0_06, 4-core Xeon X5570 dual CPU @2.93Ghz with hyperthreading switched on (16 virtual cores)

Slide 37

Slide 37 text

LMAX DISRUPTOR removes the kernel need for locks on the CPU level

Slide 38

Slide 38 text

CHAINSAW

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

The story of log4php Community

Slide 41

Slide 41 text

Good times, bad times 1999 2005 2010 2011

Slide 42

Slide 42 text

You are welcome Join ~8 active committers.

Slide 43

Slide 43 text

We are back! 2013: 1018 Changes 4730 Mails 2014: 1502 Changes 8501 Mails

Slide 44

Slide 44 text

Seriously. Isn‘t logging just BORING?

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

With new innovation, new logging challenges come up. Logging needs innovation too.

Slide 47

Slide 47 text

Logger Log Collector Log Search Log Analysis

Slide 48

Slide 48 text

Logger Log Collector Log Search Log Analysis

Slide 49

Slide 49 text

Logger Log Collector Log Search Log Analysis

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

Logging is mission critical.

Slide 52

Slide 52 text

One last thing...

Slide 53

Slide 53 text

Do we need a new Logging JSR? java.net/projects/newlogging

Slide 54

Slide 54 text

We are hiring! use it! ask questions! spread the love! send patches! [email protected]

Slide 55

Slide 55 text

Christian Grobmeier @grobmeier http://www.grobmeier.de Merci && Baba!

Slide 56

Slide 56 text

Image Credits Writing Girl (Erin Kohlenberg) Captain Kirk (http://dave-daring.deviantart.com/) Vulcano (Martin Barland) Fire Brigade (State Library of South Australia) Gear Necklace Designs (Eric Skiff) 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) 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) Steve (https://www.flickr.com/photos/-macjasp/) Paul Carmody Clouds (Flickr: karindalziel) Fight (Flickr: KellBailey)