User Tools

Site Tools


java:log4j

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
java:log4j [2009/10/29 11:05]
Alexander Rind
java:log4j [2012/01/04 10:30] (current)
Alexander Rind link newer logging packes
Line 33: Line 33:
 log4j.logger.gui.MainFrame=INFO log4j.logger.gui.MainFrame=INFO
 </​file>​ </​file>​
 +
 +<code java>
 +        try {
 +            if ((new File("​log4j.properties"​)).canRead())
 +                PropertyConfigurator.configure("​log4j.properties"​);​
 +        }
 +        catch (SecurityException e) {
 +        }
 +</​code>​
  
 ===== Rationale ===== ===== Rationale =====
Line 46: Line 55:
  
 Read more opinions [[http://​www.google.at/​search?​q=log4j+java.util.logging]] Read more opinions [[http://​www.google.at/​search?​q=log4j+java.util.logging]]
 +
 +Integrate JUL into log4j:
 +  * http://​shrubbery.mynetgear.net/​c/​display/​W/​Routing%2Bjava.util.logging%2Bmessages%2Bto%2BLog4J
 +  * http://​people.apache.org/​~psmith/​logging.apache.org/​sandbox/​jul-log4j-bridge/​examples.html
 +  * use SLF4J
  
 === log4j vs. Commons Logging === === log4j vs. Commons Logging ===
  
 [[http://​commons.apache.org/​logging/​ | Commons Logging]] seems to be a compatibility layer so that a library can work with different logging implementations. [[http://​commons.apache.org/​logging/​ | Commons Logging]] seems to be a compatibility layer so that a library can work with different logging implementations.
 +
 +=== newer logging packages ===
 +
 +  * [[http://​www.slf4j.org/​ | Simple Logging Facade for Java (SLF4J)]]
 +  * [[http://​www.slf4j.org/​nlog4j/​ | NLOG4J]] --- discontinued
 +  * [[http://​logback.qos.ch/​ | Logback]] --- planned as successor of log4j and nlog4j
  
  
Line 68: Line 88:
     * if you work with Eclipse, this will be the project directory     * if you work with Eclipse, this will be the project directory
   - in the main method **check, whether ''​log4j.properties''​ exists** in the working directory   - in the main method **check, whether ''​log4j.properties''​ exists** in the working directory
-    * if it exist, then load this file+    * if it exist and is readable, then load this file 
 +    * handle SecurityException (e.g., for Java Web Start) ​
     * if it does not exist, log4j will load the file from the classpath by default     * if it does not exist, log4j will load the file from the classpath by default
   - if users want to override this behavior, they can    - if users want to override this behavior, they can 
java/log4j.1256810727.txt · Last modified: 2009/10/29 11:05 by Alexander Rind

alex @ ieg: home about me publications research