22 Temmuz 2010 Perşembe

logging in java apps

for starter, lets begin with java.util.logging..

http://www.java-tips.org/java-se-tips/java.util.logging/how-to-use-logger.html
http://www.rgagnon.com/javadetails/java-0501.html
http://www.roseindia.net/java/example/java/util/quintessential-logging-program.shtml

and log4j..
http://logging.apache.org/log4j/1.2/manual.html
http://www.basilv.com/psd/blog/2006/tips-for-using-log4j
http://homepage.mac.com/kelleherk/iblog/C1837526061/E2136921646/index.html

the interface:

package org.apache.log4j;

public class Logger {

// Creation & retrieval methods:
public static Logger getRootLogger();
public static Logger getLogger(String name);

// printing methods:
public void trace(Object message);
public void debug(Object message);
public void info(Object message);
public void warn(Object message);
public void error(Object message);
public void fatal(Object message);

// generic printing method:
public void log(Level l, Object message);
}

2 yorum:

  1. Thank you Hilal!
    in my humble opinion using the old but good "log4j" will be a better choice ;) There are some serious bugs with jdk logger that make applications crash and it is really hard to determine if the logger causes the crash.

    YanıtlaSil
  2. himm.. thanks for the tip Emre..

    YanıtlaSil