本文整理汇总了Java中org.jretty.log.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于org.jretty.log包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callLocationAwareLogger
import org.jretty.log.Logger; //导入依赖的package包/类
protected void callLocationAwareLogger(Logger lal,
LogRecord record) {
int julLevelValue = record.getLevel().intValue();
org.jretty.log.Level slf4jLevel;
if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
slf4jLevel = org.jretty.log.Level.TRACE;
} else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
slf4jLevel = org.jretty.log.Level.DEBUG;
} else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
slf4jLevel = org.jretty.log.Level.INFO;
} else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
slf4jLevel = org.jretty.log.Level.WARN;
} else {
slf4jLevel = org.jretty.log.Level.ERROR;
}
String i18nMessage = getMessageI18N(record);
lal.log(FQCN, slf4jLevel, record.getThrown(), i18nMessage);
}
示例2: publish
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Publish a LogRecord.
* <p/>
* The logging request was made initially to a Logger object, which
* initialized the LogRecord and forwarded it here.
* <p/>
* This handler ignores the Level attached to the LogRecord, as SLF4J cares
* about discarding log statements.
*
* @param record Description of the log event. A null record is silently ignored
* and is not published.
*/
public void publish(LogRecord record) {
// Silently ignore null records.
if (record == null) {
return;
}
Logger mlf4jLogger = getMLF4JLogger(record);
String message = record.getMessage(); // can be null!
// this is a check to avoid calling the underlying logging system
// with a null message. While it is legitimate to invoke j.u.l. with
// a null message, other logging frameworks do not support this.
// see also http://bugzilla.slf4j.org/show_bug.cgi?id=108
if (message == null) {
message = "";
}
callLocationAwareLogger(mlf4jLogger, record);
}
示例3: testGetInputStreamFromJar
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* 取得class所在 jar包 中的资源 {注意jar必须在文件目录下,不能在war或ear包中}<BR>
*/
@Test
public void testGetInputStreamFromJar(){
getInputStreamFromJar(Logger.class, "org/jretty/log/Logger.class");
getInputStreamFromJar(Logger.class, "org/jretty/log/");
noInputStreamFromJar(Logger.class, "zollty-log0.properties");
}
示例4: uninstall
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Removes previously installed SLF4JBridgeHandler instances. See also
* {@link #install()}.
*
* @throws SecurityException A <code>SecurityException</code> is thrown, if a security manager
* exists and if the caller does not have
* LoggingPermission("control").
*/
public static void uninstall() throws SecurityException {
java.util.logging.Logger rootLogger = getRootLogger();
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
if (handlers[i] instanceof SLF4JBridgeHandler) {
rootLogger.removeHandler(handlers[i]);
}
}
}
示例5: isInstalled
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise.
*
* @return true if SLF4JBridgeHandler is already installed, false other wise
* @throws SecurityException
*/
public static boolean isInstalled() throws SecurityException {
java.util.logging.Logger rootLogger = getRootLogger();
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
if (handlers[i] instanceof SLF4JBridgeHandler) {
return true;
}
}
return false;
}
示例6: removeHandlersForRootLogger
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Invoking this method removes/unregisters/detaches all handlers currently attached to the root logger
* @since 1.6.5
*/
public static void removeHandlersForRootLogger() {
java.util.logging.Logger rootLogger = getRootLogger();
java.util.logging.Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
rootLogger.removeHandler(handlers[i]);
}
}
示例7: getMLF4JLogger
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Return the Logger instance that will be used for logging.
*/
protected Logger getMLF4JLogger(LogRecord record) {
String name = record.getLoggerName();
if (name == null) {
name = UNKNOWN_LOGGER_NAME;
}
return LogFactory.getLogger(name);
}
示例8: parseExcludeSuffix
import org.jretty.log.Logger; //导入依赖的package包/类
public static Set<String> parseExcludeSuffix(String suffix) {
Set<String> excludeSuffixes = new HashSet<String>();
boolean bt = false;
String[] tarry = null;
// 后缀,取配置值或者默认值
bt = false;
if (suffix != null) {
suffix = suffix.replaceAll(" ", "");
if (suffix.length() != 0) {
bt = true;
}
}
if (bt) {
tarry = MvcUtils.StringSplitUtil.splitIgnoreEmpty(suffix, ',');
excludeSuffixes.addAll(new HashSet<String>(Arrays.asList(tarry)));
}
Logger log = LogFactory.getLogger(ConfigTools.class);
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder(40);
sb.append("suffix = [{");
for (String suff : excludeSuffixes) {
sb.append(suff).append("},{");
}
sb.append("}]");
int index = sb.lastIndexOf(",{}]");
if (index != -1) {
sb = new StringBuilder(sb.substring(0, index));
sb.append("]");
}
log.debug("no-intercept - " + sb.toString());
}
return excludeSuffixes;
}
示例9: getDataSource
import org.jretty.log.Logger; //导入依赖的package包/类
public DataSource getDataSource() {
Logger log = LogFactory.getLogger(JndiDataSourceCreator.class);
JndiTemplate jndiTemplate = new JndiTemplate();
try {
return jndiTemplate.lookup(jndiName, javax.sql.DataSource.class);
}
catch (NamingException e) {
log.error(e, "get jndi datasource error, jndiName=" + jndiName);
}
return null;
}
示例10: JrettySlf4jLog
import org.jretty.log.Logger; //导入依赖的package包/类
JrettySlf4jLog(Logger logger) {
this.logger = logger;
this.name = logger.getName();
}
示例11: getRootLogger
import org.jretty.log.Logger; //导入依赖的package包/类
private static java.util.logging.Logger getRootLogger() {
return LogManager.getLogManager().getLogger("");
}
示例12: JrettyCommonsLog
import org.jretty.log.Logger; //导入依赖的package包/类
JrettyCommonsLog(Logger logger) {
this.logger = logger;
this.name = logger.getName();
}
示例13: getParentLogger
import org.jretty.log.Logger; //导入依赖的package包/类
public java.util.logging.Logger getParentLogger() {
return java.util.logging.Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME);
}
示例14: parseExcludePrefix
import org.jretty.log.Logger; //导入依赖的package包/类
public static Set<String> parseExcludePrefix(String prefix) {
Set<String> excludePrefixes = new HashSet<String>();
// 前缀,为空则不拦截
boolean bt = false;
String[] tarry = null;
if (prefix != null) {
prefix = prefix.replaceAll(" ", "");
if (prefix.length() != 0) {
bt = true;
}
}
if (bt) {
tarry = MvcUtils.StringSplitUtil.splitIgnoreEmpty(prefix, ',');
// 检测前缀
String add = "/";
String tmp = null;
for (int i = 0; i < tarry.length; i++) {
tmp = tarry[i];
if (tmp.charAt(0) == '/') {
excludePrefixes.add(tmp);
}
else {
excludePrefixes.add(add + tmp);
}
}
}
Logger log = LogFactory.getLogger(ConfigTools.class);
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder(40);
sb.append("prefix = [{");
for (String pref : excludePrefixes) {
sb.append(pref).append("},{");
}
sb.append("}]");
int index = sb.lastIndexOf(",{}]");
if (index != -1) {
sb = new StringBuilder(sb.substring(0, index));
sb.append("]");
}
log.debug("no-intercept - " + sb.toString());
}
return excludePrefixes;
}
示例15: readResolve
import org.jretty.log.Logger; //导入依赖的package包/类
/**
* Replace this instance with a homonymous (same name) logger returned
* by LoggerFactory. Note that this method is only called during
* deserialization.
*
* <p>
* This approach will work well if the desired ILoggerFactory is the one
* references by LoggerFactory. However, if the user manages its logger hierarchy
* through a different (non-static) mechanism, e.g. dependency injection, then
* this approach would be mostly counterproductive.
*
* @return logger with same name as returned by LoggerFactory
* @throws ObjectStreamException
*/
protected Object readResolve() throws ObjectStreamException {
Logger logger = org.jretty.log.LogFactory.getLogger(this.name);
return new JrettySlf4jLog(logger);
}