Example usage for org.apache.commons.logging LogFactory getLog

List of usage examples for org.apache.commons.logging LogFactory getLog

Introduction

In this page you can find the example usage for org.apache.commons.logging LogFactory getLog.

Prototype

public static Log getLog(String name) 

Source Link

Document

Convenience method to return a named logger.

Usage

From source file:com.alfaariss.oa.profile.saml2.profile.metadata.IDPMetadata.java

/**
 * Constructor. 
 */
public IDPMetadata() {
    _logger = LogFactory.getLog(IDPMetadata.class);
}

From source file:dk.statsbiblioteket.util.LogsTest.java

/**
 * imply test that the log methods do not
 * throw exceptions/* w  w  w .  jav  a 2s .com*/
 */
public void testLogging() {
    Log log = LogFactory.getLog(LogsTest.class);
    Exception e = new RuntimeException("Dummy exception");
    List<Integer> list = new ArrayList<Integer>();
    int[] intArray = new int[0];

    for (int i = 0; i < 100; i++) {
        list.add(i);
    }

    Logs.log(log, Logs.Level.INFO, "hello");
    Logs.log(log, Logs.Level.INFO, "hello", e);
    Logs.logExpand(log, Logs.Level.INFO, "list: ", list);
    Logs.logExpand(log, Logs.Level.INFO, "empty array: ", intArray);
}

From source file:com.alfaariss.oa.engine.authorization.configuration.ConfigurationMethod.java

/**
 * Creates a method object./*from w w w.j a va2s .  c  o m*/
 *
 * Creates the method object by reading the required information from the 
 * configuration file.
 * @param oConfigurationManager The configuration manager where the 
 * configuration can be read from.
 * @param eConfig the configuration section with the configuration needed 
 * for this method.
 * @throws AuthorizationException
 */
public ConfigurationMethod(IConfigurationManager oConfigurationManager, Element eConfig)
        throws AuthorizationException {
    super();
    try {
        _logger = LogFactory.getLog(ConfigurationMethod.class);

        _sID = oConfigurationManager.getParam(eConfig, "id");
        if (_sID == null) {
            _logger.error("No 'id' item in 'profile' section found in configuration");
            throw new AuthorizationException(SystemErrors.ERROR_CONFIG_READ);
        }
    } catch (AuthorizationException e) {
        throw e;
    } catch (Exception e) {
        _logger.fatal("Internal error during initialization", e);
        throw new AuthorizationException(SystemErrors.ERROR_INTERNAL);
    }
}

From source file:net.big_oh.common.utils.Duration.java

/**
 * Constructs a default Duration instance using callingClass to derive an
 * appropriate logger.//  w  w w .  java 2 s.  co m
 * 
 * @param callingClass
 */
public Duration(Class<?> callingClass) {
    started = System.currentTimeMillis();
    logger = (callingClass == null) ? defaultLogger : LogFactory.getLog(callingClass);
    status = DURATION_STATUS.STARTED;
}

From source file:com.brienwheeler.lib.concurrent.StoppableThread.java

public StoppableThread(String name, Log log) {
    super(name);/* w  w  w  .  ja  v a2  s .co m*/
    setDaemon(true);
    if (log != null)
        this.log = log;
    else
        this.log = LogFactory.getLog(getClass());
}

From source file:com.lfv.lanzius.application.SoundClip.java

public SoundClip(Mixer outputMixer, String filenameAlternativeA, String filenameAlternativeB, int periodMillis,
        float volumeAdjustment) {
    log = LogFactory.getLog(getClass());

    if (soundTimer == null)
        soundTimer = new Timer("Ssoundclip", true);

    boolean altA = true;
    this.periodMillis = periodMillis;
    this.volumeAdjustment = volumeAdjustment;

    // Try to open the first alternative clip
    try {//from   ww w  .j  a  va  2  s .com
        stream = AudioSystem.getAudioInputStream(new File(filenameAlternativeA));
        DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, stream.getFormat());
        clip = (Clip) outputMixer.getLine(dataLineInfo);
        clip.open(stream);
    } catch (Exception ex) {
        // The first alternative clip could not be opened, try with second alternative
        try {
            if (stream != null)
                stream.close();
            if (filenameAlternativeB == null)
                throw ex;
            stream = AudioSystem.getAudioInputStream(new File(filenameAlternativeB));
            DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, stream.getFormat());
            clip = (Clip) outputMixer.getLine(dataLineInfo);
            clip.open(stream);
            altA = false;
        } catch (Exception ex2) {
            log.error("Unable to get stream for file " + filenameAlternativeA);
            log.error("Unable to get stream for file " + filenameAlternativeB);
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException ex3) {
                    log.error("Error closing stream ", ex3);
                }
            }
            stream = null;
            return;
        }
    }

    int clipLength = (int) (clip.getMicrosecondLength() / 1000L);
    log.debug("Loading sound clip " + (altA ? filenameAlternativeA : filenameAlternativeB) + " (" + clipLength
            + "ms)");
    // Check length
    if (periodMillis < clipLength)
        throw new IllegalArgumentException("The periodMillis value must be larger than length of the clip");
}

From source file:arena.utils.XMLUtils.java

/**
 * Searches the node for content of type Long. If non-long content is found,
 * it logs a warning and returns null./* w  w w . ja  va 2  s.  c om*/
 */
public static Integer extractIntegerFromElement(Node element) {
    // Get the content and try to parse for a long
    String nodeContent = extractStringFromElement(element);

    if (nodeContent == null) {
        return null;
    } else {
        try {
            return new Integer(nodeContent);
        } catch (NumberFormatException err) {
            LogFactory.getLog(XMLUtils.class).warn("Invalid data in integer field: " + nodeContent);

            return null;
        }
    }
}

From source file:fr.aliasource.webmail.proxy.impl.ResponderImpl.java

public ResponderImpl(HttpServletResponse resp) {
    this.resp = resp;
    logger = LogFactory.getLog(getClass());
}

From source file:com.alfaariss.oa.engine.authentication.configuration.ConfigurationMethod.java

/**
 * Creates a method object./*from w w  w.  jav  a2s. com*/
 *
 * Creates the method object by reading the required information from the 
 * configuration file.
 * @param oConfigurationManager The configuration manager where the 
 * configuration can be read from.
 * @param eConfig the configuration section with the configuration needed 
 * for this method.
 * @throws AuthenticationException
 */
public ConfigurationMethod(IConfigurationManager oConfigurationManager, Element eConfig)
        throws AuthenticationException {
    super();
    try {
        _logger = LogFactory.getLog(ConfigurationMethod.class);

        _sID = oConfigurationManager.getParam(eConfig, "id");
        if (_sID == null) {
            _logger.error("No 'id' item in 'profile' section found in configuration");
            throw new AuthenticationException(SystemErrors.ERROR_CONFIG_READ);
        }
    } catch (AuthenticationException e) {
        throw e;
    } catch (Exception e) {
        _logger.fatal("Internal error during initialization", e);
        throw new AuthenticationException(SystemErrors.ERROR_INTERNAL);
    }
}

From source file:com.alfaariss.oa.engine.user.provisioning.translator.standard.common.ProfileItem.java

/**
 * Creates the object./*  w w w  .ja  v a  2  s  .  c om*/
 * @param oConfigurationManager the configuration manager.
 * @param eConfig the configuration section containing the configuration 
 *  of this object
 * @param oConverterManager the converter manager
 * @throws UserException if creation fails
 */
public ProfileItem(IConfigurationManager oConfigurationManager, Element eConfig,
        ConverterManager oConverterManager) throws UserException {
    try {
        _logger = LogFactory.getLog(ProfileItem.class);

        _sDefault = oConfigurationManager.getParam(eConfig, "default");
        if (_sDefault == null)
            _logger.info("No optional 'default' configured");

        _sField = oConfigurationManager.getParam(eConfig, "field");
        if (_sField == null)
            _logger.info("No optional 'field' configured");

        String sConverterId = oConfigurationManager.getParam(eConfig, "converter");
        if (sConverterId == null)
            _logger.info("No optional 'converter' configured");
        else {
            if (oConverterManager == null) {
                _logger.error(
                        "Could not load configured 'converter', because Converter Manager is not available");
                throw new UserException(SystemErrors.ERROR_INIT);
            }

            _oConverter = oConverterManager.getConverter(sConverterId);
            if (_oConverter == null) {
                _logger.error("Configured 'converter' doesn't exist: " + sConverterId);
                throw new UserException(SystemErrors.ERROR_INIT);
            }
        }
    } catch (UserException e) {
        throw e;
    } catch (Exception e) {
        _logger.error("Could not create object", e);
        throw new UserException(SystemErrors.ERROR_INTERNAL);
    }
}