本文整理汇总了Java中freemarker.log.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于freemarker.log包,在下文中一共展示了Logger类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configuration
import freemarker.log.Logger; //导入依赖的package包/类
@Singleton
@Provides
public static Configuration configuration(LinkHelper linkHelper, MultiTemplateLoader templateLoader) {
try {
freemarker.log.Logger.selectLoggerLibrary(Logger.LIBRARY_SLF4J);
Configuration cfg = new freemarker.template.Configuration(Configuration.VERSION_2_3_25);
cfg.setTagSyntax(freemarker.template.Configuration.SQUARE_BRACKET_TAG_SYNTAX);
cfg.setLazyAutoImports(true);
cfg.setLocale(Locale.GERMANY); // todo make configurable
cfg.addAutoImport("saito", "saito.ftl");
cfg.setSharedVariable("saitoLinkHelper", linkHelper);
cfg.setDefaultEncoding("UTF-8");
cfg.setLogTemplateExceptions(false);
cfg.setTemplateLoader(templateLoader);
return cfg;
} catch (TemplateModelException | ClassNotFoundException e) {
log.error("Error creating config", e);
throw new IllegalStateException(e);
}
}
开发者ID:marcobehler,项目名称:saito,代码行数:21,代码来源:FreemarkerModule.java
示例2: execute
import freemarker.log.Logger; //导入依赖的package包/类
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars,TemplateDirectiveBody body) throws TemplateException, IOException {
String templateName=env.getMainTemplate().getName();
Logger logger = Logger.getLogger(templateName);
try {
String msg=getTraceIfLevelActive(logger, null, body);
logger.debug(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:jerolba,项目名称:funsteroid,代码行数:12,代码来源:TraceMacro.java
示例3: getTraceIfLevelActive
import freemarker.log.Logger; //导入依赖的package包/类
private String getTraceIfLevelActive(Logger logger, String level,TemplateDirectiveBody body) throws Exception{
if (logger.isDebugEnabled()){
ByteArrayOutputStream baos=MacroHelper.renderInnerTag(body);
return new String(baos.toByteArray());
}
return null;
}
开发者ID:jerolba,项目名称:funsteroid,代码行数:8,代码来源:TraceMacro.java
示例4: defaultFreemarkerConfig
import freemarker.log.Logger; //导入依赖的package包/类
public static Configuration defaultFreemarkerConfig() {
Version freemarkerVersion = new Version(2, 3, 21);
try {
Logger.selectLoggerLibrary(Logger.LIBRARY_SLF4J);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Error setting up logging library: " + e.getMessage(), e);
}
freemarker.template.Configuration fmConfig = new freemarker.template.Configuration(freemarkerVersion);
fmConfig.setClassForTemplateLoading(FreemarkerRenderer.class, "/templates");
fmConfig.setObjectWrapper(new DefaultObjectWrapperBuilder(freemarkerVersion).build());
fmConfig.setDefaultEncoding("UTF-8");
fmConfig.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
return fmConfig;
}
开发者ID:internetitem,项目名称:jaxrs-html-provider,代码行数:15,代码来源:FreemarkerRenderer.java
示例5: contextInitialized
import freemarker.log.Logger; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
// SLF4J logging must be selected manually in Freemarker 2.3.x
Logger.selectLoggerLibrary(Logger.LIBRARY_SLF4J);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
开发者ID:yamingd,项目名称:argo,代码行数:11,代码来源:FreemarkerLoggingInitialiser.java
示例6: deshabilitarLogging
import freemarker.log.Logger; //导入依赖的package包/类
private void deshabilitarLogging() throws Exception {
Logger.selectLoggerLibrary(Logger.LIBRARY_NONE);
}
开发者ID:GovernIB,项目名称:helium,代码行数:4,代码来源:PlantillaDocumentDao.java
示例7: deshabilitarLogging
import freemarker.log.Logger; //导入依赖的package包/类
private void deshabilitarLogging() throws ClassNotFoundException {
Logger.selectLoggerLibrary(Logger.LIBRARY_NONE);
}
开发者ID:GovernIB,项目名称:helium,代码行数:4,代码来源:PlantillaHelper.java
注:本文中的freemarker.log.Logger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论