本文整理了Java中jodd.log.Logger.info()
方法的一些代码示例,展示了Logger.info()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.info()
方法的具体详情如下:
包路径:jodd.log.Logger
类名称:Logger
方法名:info
[英]Logs a message at INFO level.
[中]在信息级别记录消息。
代码示例来源:origin: oblac/jodd
@Override
public void start() {
final long startTime = System.currentTimeMillis();
webappConfigurations.forEach(Runnable::run);
elapsed += (System.currentTimeMillis() - startTime);
log.info(createInfoMessage());
}
代码示例来源:origin: oblac/jodd
/**
* Stops <em>Madvoc</em> web application.
*/
public void stopWebApplication() {
log.info("Madvoc shutting down...");
if (servletContext != null) {
servletContext.removeAttribute(MADVOC_ATTR);
}
webapp.shutdown();
webapp = null;
}
代码示例来源:origin: oblac/jodd
/**
* Shutdows the web application. Triggers the STOP event.
* @see MadvocComponentLifecycle
*/
public void shutdown() {
log.info("Madvoc shutting down...");
madvocContainer.fireEvent(MadvocComponentLifecycle.Stop.class);
}
代码示例来源:origin: oblac/jodd
@Override
public void init() {
final long startTime = System.currentTimeMillis();
try {
log.info("Scanning...");
classScanner.start();
} catch (Exception ex) {
throw new MadvocException("Scan classpath error", ex);
}
madvocComponents.forEach(Runnable::run);
log.info("Scanning is complete.");
elapsed = System.currentTimeMillis() - startTime;
}
代码示例来源:origin: oblac/jodd
/**
* Logs a message at INFO level.
*/
default void info(final Supplier<String> messageSupplier) {
if (isInfoEnabled()) {
info(messageSupplier.get());
}
}
代码示例来源:origin: oblac/jodd
@Override
public void stop() {
if (log != null) {
log.info("MADVOC stop ----------");
}
if (webApp != null) {
webApp.shutdown();
}
webApp = null;
}
代码示例来源:origin: oblac/jodd
/**
* Stops Petite container.
*/
@Override
public void stop() {
if (log != null) {
log.info("PETITE stop");
}
if (petiteContainer != null) {
petiteContainer.shutdown();
}
petiteContainer = null;
}
代码示例来源:origin: oblac/jodd
/**
* Loads Madvoc component that will be used for configuring the user actions.
* If class name is <code>null</code>, default {@link AutomagicMadvocConfigurator}
* will be used.
*/
protected void resolveMadvocConfigClass() {
if ((madvocConfiguratorClassName == null) && (madvocConfiguratorClass == null)) {
return;
}
try {
if (madvocConfiguratorClassName != null) {
madvocConfiguratorClass = ClassLoaderUtil.loadClass(madvocConfiguratorClassName);
}
log.info("Configuring Madvoc using: " + madvocConfiguratorClass.getName());
} catch (Exception ex) {
throw new MadvocException("Unable to load Madvoc configurator class: " + madvocConfiguratorClassName, ex);
}
}
代码示例来源:origin: oblac/jodd
/**
* Creates Proxetta with all aspects. The following aspects are created:
* <ul>
* <li>Transaction proxy - applied on all classes that contains public top-level methods
* annotated with <code>@Transaction</code> annotation. This is just one way how proxies
* can be applied - since base configuration is in Java, everything is possible.</li>
* </ul>
*/
@Override
public void start() {
initLogger();
log.info("PROXETTA start ----------");
final ProxyAspect[] proxyAspectsArray = this.proxyAspects.toArray(new ProxyAspect[0]);
log.debug("Total proxy aspects: " + proxyAspectsArray.length);
// proxetta = Proxetta.wrapperProxetta().setCreateTargetInDefaultCtor(true).withAspects(proxyAspectsArray);
proxetta = Proxetta.proxyProxetta().withAspects(proxyAspectsArray);
log.info("PROXETTA OK!");
}
代码示例来源:origin: oblac/jodd
/**
* Close all the connections. Use with caution: be sure no connections are in
* use before calling. Note that you are not <i>required</i> to call this
* when done with a ConnectionPool, since connections are guaranteed to be
* closed when garbage collected. But this method gives more control
* regarding when the connections are closed.
*/
@Override
public synchronized void close() {
if (log.isInfoEnabled()) {
log.info("Core connection pool shutdown");
}
closeConnections(availableConnections);
availableConnections = new ArrayList<>(maxConnections);
closeConnections(busyConnections);
busyConnections = new ArrayList<>(maxConnections);
}
代码示例来源:origin: oblac/jodd
@Override
public void start() {
initLogger();
final String resourceName = StringUtil.replaceChar(JoyPaths.class.getName(), '.', '/') + ".class";
URL url = ClassLoaderUtil.getResourceUrl(resourceName);
if (url == null) {
throw new JoyException("Failed to resolve app dir, missing: " + resourceName);
}
final String protocol = url.getProtocol();
if (!protocol.equals("file")) {
try {
url = new URL(url.getFile());
} catch (MalformedURLException ignore) {
}
}
appDir = url.getFile();
final int ndx = appDir.indexOf("WEB-INF");
appDir = (ndx > 0) ? appDir.substring(0, ndx) : SystemUtil.info().getWorkingDir();
System.setProperty(APP_DIR, appDir);
log.info("Application folder: " + appDir);
}
代码示例来源:origin: oblac/jodd
/**
* Checks if connection provider can return a connection.
*/
protected void checkConnectionProvider() {
final Connection connection = connectionProvider.getConnection();
try {
final DatabaseMetaData databaseMetaData = connection.getMetaData();
String name = databaseMetaData.getDatabaseProductName();
String version = databaseMetaData.getDatabaseProductVersion();
if (log.isInfoEnabled()) {
log.info("Connected to database: " + name + " v" + version);
}
} catch (SQLException sex) {
log.error("DB connection failed: ", sex);
} finally {
connectionProvider.closeConnection(connection);
}
}
代码示例来源:origin: oblac/jodd
/**
* Stops the Joy.
*/
public void stop() {
joyProps.stop();
try {
joyDb.stop();
joyPetite.stop();
}
catch (Exception ignore) {
}
if (log != null) {
log.info("Joy is down. Bye, bye!");
}
}
代码示例来源:origin: oblac/jodd
@Override
public void stop() {
if (!databaseEnabled) {
return;
}
if (log != null) {
log.info("DB stop");
}
if (jtxManager != null) {
jtxManager.close();
}
jtxManager = null;
if (connectionProvider != null) {
connectionProvider.close();
}
connectionProvider = null;
if (dbOom != null) {
dbOom.shutdown();
}
dbOom = null;
}
代码示例来源:origin: oblac/jodd
/**
* Configures {@link jodd.petite.PetiteContainer} with specified class path.
*/
public void configure() {
long elapsed = System.currentTimeMillis();
final ClassScanner classScanner = new ClassScanner();
classScanner.detectEntriesMode(true);
classScanner.scanDefaultClasspath();
classScannerConsumers.accept(classScanner);
registerAsConsumer(classScanner);
try {
classScanner.start();
} catch (Exception ex) {
throw new PetiteException("Scan classpath error", ex);
}
elapsed = System.currentTimeMillis() - elapsed;
log.info("Petite configured in " + elapsed + " ms. Total beans: " + container.beansCount());
}
代码示例来源:origin: oblac/jodd
@Test
void testLevel() {
//when
logger.trace(LoggerConstants.TRACE_MESSAGE);
//then
verify(log).log(java.util.logging.Level.FINER, LoggerConstants.TRACE_MESSAGE);
//when
logger.debug(LoggerConstants.DEBUG_MESSAGE);
//then
verify(log).log(java.util.logging.Level.FINE, LoggerConstants.DEBUG_MESSAGE);
//when
logger.info(LoggerConstants.INFO_MESSAGE);
//then
verify(log).log(java.util.logging.Level.INFO, LoggerConstants.INFO_MESSAGE);
//when
logger.warn(LoggerConstants.WARN_MESSAGE);
//then
verify(log).log(java.util.logging.Level.WARNING, LoggerConstants.WARN_MESSAGE);
//when
logger.error(LoggerConstants.ERROR_MESSAGE);
//then
verify(log).log(java.util.logging.Level.SEVERE, LoggerConstants.ERROR_MESSAGE);
}
代码示例来源:origin: oblac/jodd
/**
* Loads Madvoc parameters. New {@link Props} is created from the classpath.
*/
protected Props loadMadvocParams(final String[] patterns) {
if (log.isInfoEnabled()) {
log.info("Loading Madvoc parameters from: " + Converter.get().toString(patterns));
}
try {
return new Props().loadFromClasspath(patterns);
} catch (Exception ex) {
throw new MadvocException("Unable to load Madvoc parameters from: " +
Converter.get().toString(patterns) + ".properties': " + ex.toString(), ex);
}
}
代码示例来源:origin: oblac/jodd
/**
* Configures {@link DbEntityManager} with specified class path.
*/
public void configure() {
long elapsed = System.currentTimeMillis();
final ClassScanner classScanner = new ClassScanner();
classScanner.detectEntriesMode(true);
classScanner.scanDefaultClasspath();
classScannerConsumers.accept(classScanner);
registerAsConsumer(classScanner);
try {
classScanner.start();
} catch (Exception ex) {
throw new DbOomException("Scan classpath error", ex);
}
elapsed = System.currentTimeMillis() - elapsed;
if (log.isInfoEnabled()) {
log.info("DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager.getTotalNames());
}
}
代码示例来源:origin: oblac/jodd
/**
* Authenticate user and start user session.
*/
protected JsonResult login() {
T authToken;
authToken = loginViaBasicAuth(servletRequest);
if (authToken == null) {
authToken = loginViaRequestParams(servletRequest);
}
if (authToken == null) {
log.warn("Login failed.");
return JsonResult.of(HttpStatus.error401().unauthorized("Login failed."));
}
log.info("login OK!");
final UserSession<T> userSession = new UserSession<>(authToken, userAuth.tokenValue(authToken));
userSession.start(servletRequest, servletResponse);
// return token
return tokenAsJson(authToken);
}
代码示例来源:origin: oblac/jodd
@Test
void testLog() {
//given
throwable = mock(Throwable.class);
//when
//The below methods are no op methods in actual implementations.
//so we will not be able to verify anything
logger.log(Level.DEBUG, name);
logger.trace(name);
logger.debug(name);
logger.info(name);
logger.warn(name);
logger.warn(name, throwable);
logger.error(name);
logger.error(name, throwable);
}
内容来源于网络,如有侵权,请联系作者删除!