Log4jquickref

  • Uploaded by: S R Krishnan
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Log4jquickref as PDF for free.

More details

  • Words: 352
  • Pages: 1
Log4j Quick Reference Card Priorities Level ALL TRACE DEBUG INFO WARN ERROR FATAL OFF

Description Output of all messages Detailed Debugging Debugging (Method xy called with param abc …) General information (Program started/ended, connected to host foo, calculation took n seconds) Unexpected situation Error (Exception caught) Critical error, program stops Logging is deactivated

Usage: log4j.rootLogger=Level, Appender, Appender, ... log4j.logger.Package.Package.Class=Level

Appenders Name ConsoleAppender FileAppender RollingFileAppender DailyRollingFileAppender SyslogAppender NTEventLogAppender SMTPAppender net.SocketAppender net.SocketHubAppender

Writes to Stdandard Output (Console) File File, creates a new based on file size File, creates a new based on time UNIX Syslog Windows Event-Log e-mail Socket (client mode) Socket (server mode)

Usage: log4j.appender.Appender=org.apache.log4j.Name

Layouts Name PatternLayout SimpleLayout TTCCLayout HTMLLayout XMLLayout

Description Conversion Pattern Level and Message = time, thread, category, context HTML Table XML

Usage: log4j.appender.Appender.layout=org.apache.log4j.Name

PatternLayout c category; a.b.c -> %c{2} = a.b C fully qualified class name (slow); org.apache.xyz.SomeClass -> %C{1} = SomeClass d date; %d{HH:mm:ss,SSS}, %d{ABSOLUTE}, %d{DATE}, %d{ISO8601} F file name (extremly slow) l location (extremly slow) L line number (extremly slow) % percent sign

m message M method name (extremly slow) n line separator; \n or \r\n p priority r milliseconds from layout construction t thread name x nested diagnostic context of thread X mapped diagnositc context of thred; %X{clientNumber}

Format Modifier Modifier %20c %-20c %.30c %20.30c

left justify false true NA false

%-20.30c true

min. width 20 20 none 20

max. width none none 30 30

20

30

comment Left pad with spaces if the name is less than 20 characters long. Right pad with spaces if the name is less than 20 characters long. Truncate from the beginning if the name is longer than 30 characters. Left pad with spaces if the name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the beginning. Right pad with spaces if the name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the beginning.

log4j.rootLogger=WARN, stdout, logfile, socket log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%-5p [%-4t] %-25.25c %m%n log4j.appender.logfile=org.apache.log4j.RollingFileAppender log4j.appender.logfile.File=${java.io.tmpdir}/myapp.log log4j.appender.logfile.MaxFileSize=512KB log4j.appender.logfile.MaxBackupIndex=3 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d %r [%t] %-5p %c %x - %m%n log4j.appender.socket=org.apache.log4j.net.SocketHubAppender log4j.appender.socket.port=10005 log4j.appender.socket.locationInfo=true log4j.logger.com.my.app=DEBUG

Related Documents

Log4jquickref
December 2019 8

More Documents from "S R Krishnan"

Log4jquickref
December 2019 8
Log4j Tutorial En
December 2019 18
Struts Ejb Integration En
December 2019 8
Sow Format
May 2020 22
Sgt.docx
November 2019 10