Example usage for java.util.logging Logger getResourceBundleName

List of usage examples for java.util.logging Logger getResourceBundleName

Introduction

In this page you can find the example usage for java.util.logging Logger getResourceBundleName.

Prototype

public String getResourceBundleName() 

Source Link

Document

Retrieve the localization resource bundle name for this logger.

Usage

From source file:fr.opensagres.xdocreport.core.logging.LogUtils.java

private static void doLog(Logger log, Level level, String msg, Throwable t) {
    LogRecord record = new LogRecord(level, msg);

    record.setLoggerName(log.getName());
    record.setResourceBundleName(log.getResourceBundleName());
    record.setResourceBundle(log.getResourceBundle());

    if (t != null) {
        record.setThrown(t);//  w w w.j a v  a2  s.c  om
    }

    // try to get the right class name/method name - just trace
    // back the stack till we get out of this class
    StackTraceElement stack[] = (new Throwable()).getStackTrace();
    String cname = LogUtils.class.getName();
    for (int x = 0; x < stack.length; x++) {
        StackTraceElement frame = stack[x];
        if (!frame.getClassName().equals(cname)) {
            record.setSourceClassName(frame.getClassName());
            record.setSourceMethodName(frame.getMethodName());
            break;
        }
    }
    log.log(record);
}

From source file:alma.acs.logging.AcsLogger.java

/**
 * Client applications that use ACS class <code>ComponentClient</code> may need to turn their own JDK Logger into
 * an <code>AcsLogger</code>.
 * <p>/*  www .j  a v  a 2s.co  m*/
 * If <code>logger</code> is itself of sub-type <code>AcsLogger</code> then it is returned directly without being wrapped.
 * The wrapping logger shares the parent logger and the log level with the provided logger.
 * 
 * @param logger
 *            the JDK logger
 * @param wrapperName
 *            Name of the returned AcsLogger. May be <code>null</code> in which case the delegate's name plus
 *            "wrapper" is taken.
 * @return an AcsLogger that delegates to the given <code>logger</code>.
 * @since ACS 8.0
 */
public static AcsLogger fromJdkLogger(Logger logger, String wrapLoggerName) {
    if (logger instanceof AcsLogger) {
        return (AcsLogger) logger;
    }
    String acsLoggerName = (wrapLoggerName != null ? wrapLoggerName.trim() : logger.getName() + "wrapper");
    AcsLogger ret = new AcsLogger(acsLoggerName, logger.getResourceBundleName(), null, true, logger);
    ret.setLevel(logger.getLevel());
    ret.setParent(logger.getParent());
    return ret;
}

From source file:org.apache.cxf.common.logging.LogUtils.java

private static void doLog(Logger log, Level level, String msg, Throwable t) {
    LogRecord record = new LogRecord(level, msg);

    record.setLoggerName(log.getName());
    record.setResourceBundleName(log.getResourceBundleName());
    record.setResourceBundle(log.getResourceBundle());

    if (t != null) {
        record.setThrown(t);/*www  .j a va 2 s  . com*/
    }

    //try to get the right class name/method name - just trace
    //back the stack till we get out of this class
    StackTraceElement stack[] = (new Throwable()).getStackTrace();
    String cname = LogUtils.class.getName();
    for (int x = 0; x < stack.length; x++) {
        StackTraceElement frame = stack[x];
        if (!frame.getClassName().equals(cname)) {
            record.setSourceClassName(frame.getClassName());
            record.setSourceMethodName(frame.getMethodName());
            break;
        }
    }
    log.log(record);
}