org.opentox.toxotis.util
Class LoggingConfiguration

java.lang.Object
  extended by org.opentox.toxotis.util.LoggingConfiguration

public class LoggingConfiguration
extends Object

Helper for LOG4J global configuration.

Author:
Pantelis Sopasakis, Charalampos Chomenides

Constructor Summary
LoggingConfiguration()
           
 
Method Summary
static void configureLog4j(Class invokingClass, String loggingConfigResource)
           
static void configureLog4j(String loggingConfigResource)
          Configure the apache log4j logger providing the name of the configuration resource.
static void configureLog4j(URL loggingConfiguration)
          Configure the apache log4j logger providing the name of the configuration resource.
static void configureLog4jDefault()
          Default configuration for LOG4J.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingConfiguration

public LoggingConfiguration()
Method Detail

configureLog4jDefault

public static void configureLog4jDefault()
Default configuration for LOG4J.


configureLog4j

public static void configureLog4j(URL loggingConfiguration)
Configure the apache log4j logger providing the name of the configuration resource. Prior to the configuration the previous configurations are reset applying a org.apache.log4j.LogManager.resetConfiguration(); and afterwards the method configure in PropertyConfigurator is called using the provided configuration resource.

Parameters:
loggingConfiguration - URL of the configuring resource (locan file-like URL or remote location pointing to a log4j properties file.

configureLog4j

public static void configureLog4j(Class invokingClass,
                                  String loggingConfigResource)

configureLog4j

public static void configureLog4j(String loggingConfigResource)
Configure the apache log4j logger providing the name of the configuration resource. Edit a configuration file and store it on your local resources folder. This will be retrieved using the classloader of the invoking class. Prior to the configuration the previous configurations are reset applying a org.apache.log4j.LogManager.resetConfiguration(); and afterwards the method configure in PropertyConfigurator is called using the provided configuration resource. The local resource is usually assumed to be found under src/main/resources - unless otherwise specified or overriden by the user.

Parameters:
loggingConfigResource - Name of the configuring resource.
Throws:
IllegalArgumentException - In case the stack trace elements don't suffice to identify the invoking class (Has never happened on testing and is considered quite impossible) or if the class cannot be loaded because is not in the classpath (which is also unlikely to happen)


Copyright © 2011-2012 OpenTox. All Rights Reserved.