本文整理了Java中org.modeshape.common.logging.Logger
类的一些代码示例,展示了Logger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger
类的具体详情如下:
包路径:org.modeshape.common.logging.Logger
类名称:Logger
[英]A simple logging interface that is fully compatible with multiple logging implementations. If no specific logging implementation is found, then its defaulted to the JDK Logger implementation. This interface does take advantage of the variable arguments and autoboxing features in Java 5, reducing the number of methods that are necessary and allowing callers to supply primitive values as parameters.
[中]一个简单的日志接口,与多个日志实现完全兼容。如果未找到特定的日志记录实现,则默认为JDK Logger实现。该接口确实利用了Java 5中的变量参数和自动装箱功能,减少了必要的方法数量,并允许调用方提供原语值作为参数。
代码示例来源:origin: ModeShape/modeshape
private void logDebug(String message, Object...args) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(message, args);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void error( Throwable t,
String message,
Object... params ) {
if (logger.isErrorEnabled()) {
logger.error(t, new TextI18n(message), params);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected TikaMimeTypeDetector( Environment environment ) {
assert environment != null;
this.logger = Logger.getLogger(getClass());
// the extra classpath entry is the package name of the tika extractor, so it can be located inside AS7 (see
// RepositoryService)
ClassLoader loader = environment.getClassLoader(this, "org.modeshape.extractor.tika");
logger.debug("Initializing mime-type detector...");
initDetector(loader);
logger.debug("Successfully initialized detector: {0}", getClass().getName());
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void info( String message,
Object... params ) {
if (logger.isInfoEnabled()) {
logger.info(new TextI18n(message), params);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void warn( Throwable t,
String message,
Object... params ) {
if (logger.isWarnEnabled()) {
logger.warn(t, new TextI18n(message), params);
}
}
代码示例来源:origin: ModeShape/modeshape
public void shouldQuietlyAcceptNullMessage() {
logger.error(null);
logger.warn(null);
logger.info(null);
logger.debug(null);
logger.trace(null);
assertEquals(false, log.hasEvents());
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
private String repositoryURLFromParams( Map<?, ?> parameters ) {
if (parameters == null) {
LOG.debug("The supplied parameters are null");
return null;
}
Object rawUrl = parameters.get(RepositoryFactory.URL);
if (rawUrl == null) {
LOG.debug("No parameter found with key: " + RepositoryFactory.URL);
return null;
}
return rawUrl.toString();
}
代码示例来源:origin: ModeShape/modeshape
@Override
public Document get( String key ) {
LOGGER.debug("reading {0}", key);
TransactionStore.TransactionMap<String, Document> txContent = transactionalContent(false);
Document result = txContent != null ? txContent.getLatest(key) : persistedContent.get(key);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("{0} is {1}", key, result);
}
return result;
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
/**
* Return a logger associated with this context. This logger records only those activities within the context and provide a
* way to capture the context-specific activities. All log messages are also sent to the system logger, so classes that log
* via this mechanism should <i>not</i> also {@link Logger#getLogger(Class) obtain a system logger}.
*
* @param clazz the class that is doing the logging
* @return the logger, named after <code>clazz</code>; never null
* @see #getLogger(String)
*/
public Logger getLogger( Class<?> clazz ) {
return Logger.getLogger(clazz);
}
代码示例来源:origin: ModeShape/modeshape
public static <T extends Number> void writeHistogramToLog( Logger logger,
Histogram<T> histogram,
int barLength,
String description ) {
logger.info(MockI18n.passthrough, description != null ? description : "Histogram:");
List<String> barGraph = histogram.getTextGraph(barLength);
for (String line : barGraph) {
logger.debug(" " + line);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
private void cleanLocks() {
try {
lockManager().cleanLocks();
} catch (RepositoryException e) {
// This can only happen if the session is not live, which is checked above ...
Logger.getLogger(getClass()).error(e, JcrI18n.unexpectedException, e.getMessage());
}
}
代码示例来源:origin: org.modeshape/modeshape-common
private void closeStream() {
try {
stream.close();
} catch (IOException e) {
LOGGER.error(e, CommonI18n.errorClosingWrappedStream);
}
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void trace( String message,
Object... params ) {
logger.trace(message, params);
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldSupportAskingWhetherLoggingLevelsAreEnabled() {
logger.isErrorEnabled();
logger.isWarnEnabled();
logger.isInfoEnabled();
logger.isDebugEnabled();
logger.isTraceEnabled();
}
代码示例来源:origin: ModeShape/modeshape
protected final void warn( I18n message,
Object... params ) {
logger.warn(message, params);
problems.addWarning(message, params);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void rollback() throws IllegalStateException, SecurityException, SystemException {
if (logger.isTraceEnabled()) {
logger.trace("Rolling back transaction '{0}'", id);
}
super.rollback();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void logout() {
try {
loggedIn = false;
if (loginContext != null) loginContext.logout();
} catch (LoginException le) {
LOGGER.info(le, null);
}
}
代码示例来源:origin: ModeShape/modeshape
@Override
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldLogNoMessagesIfLog4jSetToOffLevel() {
log4jLogger.setLevel(Level.OFF);
logger.error(errorMessageWithNoParameters);
logger.warn(warningMessageWithNoParameters);
logger.info(infoMessageWithNoParameters);
logger.debug("This is a debug message with no parameters");
logger.trace("This is a trace message with no parameters");
assertEquals(false, log.hasEvents());
}
代码示例来源:origin: org.modeshape/modeshape-common
@Override
protected Class<?> findClass( String name ) throws ClassNotFoundException {
for (ClassLoader delegate : delegates) {
try {
return delegate.loadClass(name);
} catch (ClassNotFoundException e) {
LOGGER.debug(e, "Cannot load class using delegate: " + delegate.getClass().toString());
}
}
return super.findClass(name);
}
内容来源于网络,如有侵权,请联系作者删除!