Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Christian Grobmeier on Log4j 2

Christian Grobmeier on Log4j 2

More Decks by Enterprise Java User Group Austria

Other Decks in Technology

Transcript

  1. Too much t a s t e . . .

    m a k e s headache! Think on: log4j, logback, JUL, TinyLog, AVSL
  2. Instead: if (logger.isDebugEnabled()) logger.info("Hi, " + u.getA() + “ “

    + u.getB()); Write: logger.info("Hi, {} {} ", u.getA(), u.getB()); API++
  3. @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
  4. <Configuration> <Appenders> <File name="Grobmeier" fileName="target/mylog.log"> <PatternLayout> <Pattern>%d %C{1.}</Pattern> </PatternLayout> </File>

    </Appenders> <Loggers> <Logger name="com.Bar" level="trace"> <AppenderRef ref="Grobmeier"/> </Logger> Configuration
  5. 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)
  6. 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)