• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WarnStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ch.qos.logback.core.status.WarnStatus的典型用法代码示例。如果您正苦于以下问题:Java WarnStatus类的具体用法?Java WarnStatus怎么用?Java WarnStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WarnStatus类属于ch.qos.logback.core.status包,在下文中一共展示了WarnStatus类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: multiplicityWarning

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
private void multiplicityWarning(String resourceName, ClassLoader classLoader) {
    Set urlSet = null;
    StatusManager sm = this.loggerContext.getStatusManager();

    try {
        urlSet = Loader.getResourceOccurrenceCount(resourceName, classLoader);
    } catch (IOException var7) {
        sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", this.loggerContext, var7));
    }

    if (urlSet != null && urlSet.size() > 1) {
        sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.", this.loggerContext));
        Iterator i$ = urlSet.iterator();

        while (i$.hasNext()) {
            URL url = (URL) i$.next();
            sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]", this.loggerContext));
        }
    }

}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:22,代码来源:KonkerContextInitializer.java


示例2: findConfigFileURL

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
private URL findConfigFileURL(Context ctx, LoggerContext loggerContext) {
  StatusManager sm = loggerContext.getStatusManager();

  String jndiEntryForConfigResource = JNDIUtil.lookup(ctx,
          JNDI_CONFIGURATION_RESOURCE);
  // Do we have a dedicated configuration file?
  if (jndiEntryForConfigResource != null) {
    sm.add(new InfoStatus("Searching for [" + jndiEntryForConfigResource
            + "]", this));
    URL url = urlByResourceName(sm, jndiEntryForConfigResource);
    if (url == null) {
      String msg = "The jndi resource [" + jndiEntryForConfigResource
              + "] for context [" + loggerContext.getName()
              + "] does not lead to a valid file";
      sm.add(new WarnStatus(msg, this));
    }
    return url;
  } else {
    String resourceByConvention = conventionalConfigFileName(loggerContext
            .getName());
    return urlByResourceName(sm, resourceByConvention);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:24,代码来源:ContextJNDISelector.java


示例3: multiplicityWarning

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
private void multiplicityWarning(String resourceName, ClassLoader classLoader) {
  Set<URL> urlSet = null;
  StatusManager sm = loggerContext.getStatusManager();
  try {
    urlSet = Loader.getResourceOccurrenceCount(resourceName, classLoader);
  } catch (IOException e) {
    sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]",
            loggerContext, e));
  }
  if (urlSet != null && urlSet.size() > 1) {
    sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.",
            loggerContext));
    for (URL url : urlSet) {
      sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]",
              loggerContext));
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:19,代码来源:ContextInitializer.java


示例4: start

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
@Override
public void start() throws LifecycleException {
    super.start();
    ctx.start();
    if (filename == null) {
        filename = OptionHelper.getSystemProperty("logbackAccess.configurationFile");
        if (filename == null) {
            filename = DEFAULT_CONFIG_FILE;
        }
        ctx.getStatusManager().add(new InfoStatus("filename property not set. Assuming [" + filename + "]", this));
    }
    // TODO: Support classpath config
    File configFile = new File(filename);
    if (configFile.exists()) {
        try {
            JoranConfigurator jc = new JoranConfigurator();
            jc.setContext(ctx);
            jc.doConfigure(filename);
        } catch (JoranException e) {
            // TODO can we do better than printing a stack trace on syserr?
            e.printStackTrace();
        }
    } else {
        ctx.getStatusManager().add(new WarnStatus("[" + filename + "] does not exist", this));
    }

    if (!quiet) {
        StatusPrinter.print(ctx.getStatusManager());
    }
    
}
 
开发者ID:goodees,项目名称:goodees,代码行数:32,代码来源:CatalinaValve.java


示例5: start

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
@Override
public synchronized void start() {
    if (isStarted()) {
        return;
    }

    if (layout == null) {
        layout = new EchoLayout<>();
        addStatus(new WarnStatus("No layout, default to " + layout, this));
    }
    if (logGroupName == null) {
        logGroupName = getClass().getSimpleName();
        addStatus(new WarnStatus("No logGroupName, default to " + logGroupName, this));
    }
    if (logStreamName == null) {
        logStreamName = new SimpleDateFormat("yyyyMMdd'T'HHmmss").format(new Date());
        addStatus(new WarnStatus("No logGroupName, default to " + logStreamName, this));
    }
    try {
        if (awsLogs == null) {
            awsLogs = AWSLogsClientBuilder.defaultClient();
        }
        createLogGroup();
        createLogStream();
    } catch (final AmazonClientException e) {
        awsLogs = null;
        addStatus(new ErrorStatus(e.getMessage(), this, e));
    }

    // Start a new daemon time thread to periodically upload events
    // Because this is a deamon thread, it will not block shutdown
    new DaemonTimerThread().start();

    // Add a shutdown hook to catch any final events at shutdown
    Runtime.getRuntime().addShutdownHook(new ShutdownHook());

    layout.start();
    super.start();
}
 
开发者ID:minijax,项目名称:minijax,代码行数:40,代码来源:CloudWatchAppender.java


示例6: doAppend

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
public synchronized void doAppend(E eventObject) {
  // WARNING: The guard check MUST be the first statement in the
  // doAppend() method.

  // prevent re-entry.
  if (guard) {
    return;
  }

  try {
    guard = true;

    if (!this.started) {
      if (statusRepeatCount++ < ALLOWED_REPEATS) {
        addStatus(new WarnStatus(
            "Attempted to append to non started appender [" + name + "].",
            this));
      }
      return;
    }

    if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
      return;
    }

    // ok, we now invoke derived class' implementation of append
    this.append(eventObject);

  } catch (Exception e) {
    if (exceptionCount++ < ALLOWED_REPEATS) {
      addError("Appender [" + name + "] failed to append.", e);
    }
  } finally {
    guard = false;
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:37,代码来源:AppenderBase.java


示例7: targetWarn

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
private void targetWarn(String val) {
  Status status = new WarnStatus("[" + val + "] should be one of "
          + Arrays.toString(ConsoleTarget.values()), this);
  status.add(new WarnStatus(
          "Using previously set target, System.out by default.", this));
  addStatus(status);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:ConsoleAppender.java


示例8: doAppend

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
public void doAppend(E eventObject) {
  // WARNING: The guard check MUST be the first statement in the
  // doAppend() method.
    
  // prevent re-entry.
  if (Boolean.TRUE.equals(guard.get())) {
    return;
  }

  try {
    guard.set(Boolean.TRUE);

    if (!this.started) {
      if (statusRepeatCount++ < ALLOWED_REPEATS) {
        addStatus(new WarnStatus(
            "Attempted to append to non started appender [" + name + "].",
            this));
      }
      return;
    }

    if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
      return;
    }

    // ok, we now invoke derived class' implementation of append
    this.append(eventObject);

  } catch (Exception e) {
    if (exceptionCount++ < ALLOWED_REPEATS) {
      addError("Appender [" + name + "] failed to append.", e);
    }
  } finally {
    guard.set(Boolean.FALSE);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:37,代码来源:UnsynchronizedAppenderBase.java


示例9: testNested

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
@Test
public void testNested() {
  Status s0 = new ErrorStatus("test0", this);
  Status s1 = new InfoStatus("test1", this);
  Status s11 = new InfoStatus("test11", this);
  Status s12 = new InfoStatus("test12", this);
  s1.add(s11);
  s1.add(s12);
  
  Status s2 = new InfoStatus("test2", this);
  Status s21 = new InfoStatus("test21", this);
  Status s211 = new WarnStatus("test211", this);
  
  Status s22 = new InfoStatus("test22", this);
  s2.add(s21);
  s2.add(s22);
  s21.add(s211);
  
  
  Context context = new ContextBase();
  context.getStatusManager().add(s0);
  context.getStatusManager().add(s1);
  context.getStatusManager().add(s2);

  StatusPrinter.print(context);
  String result = outputStream.toString();
  assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
  assertTrue(result.contains("+ WARN in "+this.getClass().getName()));
  assertTrue(result.contains("    |-WARN in "+this.getClass().getName()));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:31,代码来源:StatusPrinterTest.java


示例10: testWithException

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
@Test
public void testWithException() {
  Status s0 = new ErrorStatus("test0", this);
  Status s1 = new InfoStatus("test1", this, new Exception("testEx"));
  Status s11 = new InfoStatus("test11", this);
  Status s12 = new InfoStatus("test12", this);
  s1.add(s11);
  s1.add(s12);
  
  Status s2 = new InfoStatus("test2", this);
  Status s21 = new InfoStatus("test21", this);
  Status s211 = new WarnStatus("test211", this);
  
  Status s22 = new InfoStatus("test22", this);
  s2.add(s21);
  s2.add(s22);
  s21.add(s211);
  
  Context context = new ContextBase();
  context.getStatusManager().add(s0);
  context.getStatusManager().add(s1);
  context.getStatusManager().add(s2);
  StatusPrinter.print(context);  
  String result = outputStream.toString();
  assertTrue(result.contains("|-ERROR in "+this.getClass().getName()));
  assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
  assertTrue(result.contains("ch.qos.logback.core.util.StatusPrinterTest.testWithException"));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:29,代码来源:StatusPrinterTest.java


示例11: noAppenderDefinedWarning

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
final void noAppenderDefinedWarning(final Logger logger) {
  if (noAppenderWarning++ == 0) {
    getStatusManager().add(
            new WarnStatus("No appenders present in context [" + getName()
                    + "] for logger [" + logger.getName() + "].", logger));
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:LoggerContext.java


示例12: setTarget

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
public void setTarget(String target)
{
    if(!(target.equals("System.out") || target.equals("System.err")))
    {
        Status status = new WarnStatus("[" + target + "] should be one of System.out or System.err", this);
        status.add(new WarnStatus("Using default target System.out", this));
        addStatus(status);
        return;
    }
    this.target = target;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:12,代码来源:ConsoleAppender.java


示例13: noAppenderDefinedWarning

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
final void noAppenderDefinedWarning(KonkerLogger logger) {
    if(this.noAppenderWarning++ == 0) {
        this.getStatusManager().add(new WarnStatus("No appenders present in context [" + this.getName() + "] for logger [" + logger.getName() + "].", logger));
    }

}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:7,代码来源:KonkerLoggerContext.java


示例14: addWarn

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
public void addWarn(String msg) {
  addStatus(new WarnStatus(msg, getOrigin()));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:ContextAwareImpl.java


示例15: addWarn

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
public void addWarn(String msg) {
  addStatus(new WarnStatus(msg, getDeclaredOrigin()));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:ContextAwareBase.java


示例16: addWarn

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
static void addWarn(Context context, String msg) {
  addStatus(context, new WarnStatus(msg, origin));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:ConfigurationWatchListUtil.java


示例17: startInternal

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
@Override
public void startInternal() throws LifecycleException {
  executorService = ExecutorServiceUtil.newExecutorService();
  if (filename == null) {
  	String tomcatBaseProperty = OptionHelper
        .getSystemProperty("catalina.base");

    filename = tomcatBaseProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
    
  	File baseConfigFile = new File(filename);
  	if (!baseConfigFile.exists()) {
  	
      String tomcatHomeProperty = OptionHelper
          .getSystemProperty("catalina.home");

      filename = tomcatHomeProperty + File.separatorChar
          + DEFAULT_CONFIG_FILE;
    }
    
    getStatusManager().add(
        new InfoStatus("filename property not set. Assuming [" + filename
            + "]", this));
  }
  File configFile = new File(filename);

  if (configFile.exists()) {
    try {
      JoranConfigurator jc = new JoranConfigurator();
      jc.setContext(this);
      jc.doConfigure(filename);
    } catch (JoranException e) {
      // TODO can we do better than printing a stack trace on syserr?
      e.printStackTrace();
    }
  } else {
    getStatusManager().add(
        new WarnStatus("[" + filename + "] does not exist", this));
  }

  if (!quiet) {
    StatusPrinter.print(getStatusManager());
  }

  started = true;
  setState(LifecycleState.STARTING);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:47,代码来源:LogbackValve.java


示例18: addWarn

import ch.qos.logback.core.status.WarnStatus; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void addWarn(String msg) {
    context.getStatusManager().add(new WarnStatus(msg, context));
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:6,代码来源:DefaultLogbackConfigurator.java



注:本文中的ch.qos.logback.core.status.WarnStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TestUtils类代码示例发布时间:2022-05-23
下一篇:
Java FiberContextSwitchInterceptorFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap