org.apache.log4j.Logger.getEffectiveLevel()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(297)

本文整理了Java中org.apache.log4j.Logger.getEffectiveLevel()方法的一些代码示例,展示了Logger.getEffectiveLevel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getEffectiveLevel()方法的具体详情如下:
包路径:org.apache.log4j.Logger
类名称:Logger
方法名:getEffectiveLevel

Logger.getEffectiveLevel介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

  1. private static void process(org.apache.log4j.Logger log, String level,
  2. PrintWriter out) throws IOException {
  3. if (level != null) {
  4. if (!level.equals(org.apache.log4j.Level.toLevel(level).toString())) {
  5. out.println(MARKER + "<div class='text-danger'>" + "Bad level : <strong>" + level
  6. + "</strong><br />" + "</div>");
  7. } else {
  8. log.setLevel(org.apache.log4j.Level.toLevel(level));
  9. out.println(MARKER + "<div class='text-success'>" + "Setting Level to <strong>" + level
  10. + "</strong> ...<br />" + "</div>");
  11. }
  12. }
  13. out.println(MARKER
  14. + "Effective level: <b>" + log.getEffectiveLevel() + "</b><br />");
  15. }

代码示例来源:origin: log4j/log4j

  1. /**
  2. * Check whether this category is enabled for the TRACE Level.
  3. * @since 1.2.12
  4. *
  5. * @return boolean - <code>true</code> if this category is enabled for level
  6. * TRACE, <code>false</code> otherwise.
  7. */
  8. public boolean isTraceEnabled() {
  9. if (repository.isDisabled(Level.TRACE_INT)) {
  10. return false;
  11. }
  12. return Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel());
  13. }

代码示例来源:origin: org.apache.hadoop/hadoop-common

  1. private static void process(org.apache.log4j.Logger log, String level,
  2. PrintWriter out) throws IOException {
  3. if (level != null) {
  4. if (!level.equalsIgnoreCase(org.apache.log4j.Level.toLevel(level)
  5. .toString())) {
  6. out.println(MARKER + "Bad Level : <b>" + level + "</b><br />");
  7. } else {
  8. log.setLevel(org.apache.log4j.Level.toLevel(level));
  9. out.println(MARKER + "Setting Level to " + level + " ...<br />");
  10. }
  11. }
  12. out.println(MARKER
  13. + "Effective Level: <b>" + log.getEffectiveLevel() + "</b><br />");
  14. }

代码示例来源:origin: hibernate/hibernate-orm

  1. public boolean isEnabled(final Level level) {
  2. final org.apache.log4j.Level l = translate( level );
  3. return logger.isEnabledFor( l ) && l.isGreaterOrEqual( logger.getEffectiveLevel() );
  4. }

代码示例来源:origin: wildfly/wildfly

  1. public boolean isEnabled(final Level level) {
  2. final org.apache.log4j.Level l = translate(level);
  3. return logger.isEnabledFor(l) && l.isGreaterOrEqual(logger.getEffectiveLevel());
  4. }

代码示例来源:origin: log4j/log4j

  1. if(event.getLevel().isGreaterOrEqual(remoteLogger.getEffectiveLevel())) {

代码示例来源:origin: log4j/log4j

  1. /**
  2. * Log a message object with the {@link org.apache.log4j.Level#TRACE TRACE} level.
  3. *
  4. * @param message the message object to log.
  5. * @see #debug(Object) for an explanation of the logic applied.
  6. * @since 1.2.12
  7. */
  8. public void trace(Object message) {
  9. if (repository.isDisabled(Level.TRACE_INT)) {
  10. return;
  11. }
  12. if (Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel())) {
  13. forcedLog(FQCN, Level.TRACE, message, null);
  14. }
  15. }

代码示例来源:origin: marytts/marytts

  1. private void expandSayasElements(Document doc) {
  2. NodeList sayasElements = doc.getElementsByTagName(MaryXML.SAYAS);
  3. for (int i = 0; i < sayasElements.getLength(); i++) {
  4. Element sayas = (Element) sayasElements.item(i);
  5. String type = sayas.getAttribute("type");
  6. ExpansionPattern ep = ExpansionPattern.getPattern(type);
  7. if (ep != null) {
  8. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  9. logger.debug("Expanding say-as element of type " + type + ", containing text `"
  10. + MaryDomUtils.getPlainTextBelow(sayas) + "'");
  11. }
  12. ep.match(sayas, type);
  13. } else {
  14. // Don't know how to handle type -- ignore
  15. logger.info("Don't know how to expand say-as type=\"" + type + "\"");
  16. }
  17. }
  18. }

代码示例来源:origin: marytts/marytts

  1. private void expandSayasElements(Document doc) {
  2. NodeList sayasElements = doc.getElementsByTagName(MaryXML.SAYAS);
  3. for (int i = 0; i < sayasElements.getLength(); i++) {
  4. Element sayas = (Element) sayasElements.item(i);
  5. String type = sayas.getAttribute("type");
  6. ExpansionPattern ep = ExpansionPattern.getPattern(type);
  7. if (ep != null) {
  8. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  9. logger.debug("Expanding say-as element of type " + type + ", containing text `"
  10. + MaryDomUtils.getPlainTextBelow(sayas) + "'");
  11. }
  12. ep.match(sayas, type);
  13. } else {
  14. // Don't know how to handle type -- ignore
  15. logger.info("Don't know how to expand say-as type=\"" + type + "\"");
  16. }
  17. }
  18. }

代码示例来源:origin: marytts/marytts

  1. private void expandSayasElements(Document doc) {
  2. NodeList sayasElements = doc.getElementsByTagName(MaryXML.SAYAS);
  3. for (int i = 0; i < sayasElements.getLength(); i++) {
  4. Element sayas = (Element) sayasElements.item(i);
  5. String type = sayas.getAttribute("type");
  6. ExpansionPattern ep = ExpansionPattern.getPattern(type);
  7. if (ep != null) {
  8. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  9. logger.debug("Expanding say-as element of type " + type + ", containing text `"
  10. + MaryDomUtils.getPlainTextBelow(sayas) + "'");
  11. }
  12. ep.match(sayas, type);
  13. } else {
  14. // Don't know how to handle type -- ignore
  15. logger.info("Don't know how to expand say-as type=\"" + type + "\"");
  16. }
  17. }
  18. }

代码示例来源:origin: log4j/log4j

  1. /**
  2. * Log a message object with the <code>TRACE</code> level including the
  3. * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
  4. *
  5. * <p>
  6. * See {@link #debug(Object)} form for more detailed information.
  7. * </p>
  8. *
  9. * @param message the message object to log.
  10. * @param t the exception to log, including its stack trace.
  11. * @since 1.2.12
  12. */
  13. public void trace(Object message, Throwable t) {
  14. if (repository.isDisabled(Level.TRACE_INT)) {
  15. return;
  16. }
  17. if (Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel())) {
  18. forcedLog(FQCN, Level.TRACE, message, t);
  19. }
  20. }

代码示例来源:origin: marytts/marytts

  1. logger.debug("Have found multiword in dictionary: `" + multiword + "'");
  2. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  3. StringBuilder logBuf = new StringBuilder();
  4. for (Iterator<Element> it = expanded.iterator(); it.hasNext();) {

代码示例来源:origin: marytts/marytts

  1. logger.debug("Have found multiword in dictionary: `" + multiword + "'");
  2. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  3. StringBuilder logBuf = new StringBuilder();
  4. for (Iterator<Element> it = expanded.iterator(); it.hasNext();) {

代码示例来源:origin: marytts/marytts

  1. if (rawmaryxml.getType() != MaryDataType.get("RAWMARYXML"))
  2. throw new IllegalArgumentException("Expected data of type RAWMARYXML, got " + rawmaryxml.getType());
  3. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  4. logger.debug("Now splitting the following RAWMARYXML data into chunks:");
  5. ByteArrayOutputStream dummy = new ByteArrayOutputStream();

代码示例来源:origin: marytts/marytts

  1. if (writer == null)
  2. writer = new MaryNormalisedWriter();
  3. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  4. ByteArrayOutputStream debugOut = new ByteArrayOutputStream();
  5. writer.output(xmlDocument, debugOut);

代码示例来源:origin: marytts/marytts

  1. if (writer == null)
  2. writer = new MaryNormalisedWriter();
  3. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  4. ByteArrayOutputStream debugOut = new ByteArrayOutputStream();
  5. writer.output(xmlDocument, debugOut);

代码示例来源:origin: marytts/marytts

  1. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  2. debugLogCandidates(targetUnit, suitableCandidates, suitableF0Candidates);

代码示例来源:origin: marytts/marytts

  1. if (logger.getEffectiveLevel().equals(Level.DEBUG)) {
  2. debugLogCandidates(targetUnit, suitableCandidates, suitableF0Candidates);

代码示例来源:origin: apache/hbase

  1. log.info("log.info1");
  2. log.error("log.error1");
  3. assertTrue(!Level.ERROR.equals(log.getEffectiveLevel()));
  4. log.info("log.info2");
  5. log.error("log.error2");
  6. assertTrue(Level.ERROR.equals(log.getEffectiveLevel()));
  7. log.info("log.info3");
  8. log.error("log.error3");
  9. assertTrue(Level.DEBUG.equals(log.getEffectiveLevel()));
  10. } finally {
  11. if (server != null) {

代码示例来源:origin: marytts/marytts

  1. currentData.setOutputParams(outputParams);
  2. if (logger.getEffectiveLevel().equals(Level.DEBUG)
  3. && (currentData.getType().isTextType() || currentData.getType().isXMLType())) {
  4. logger.debug("Handing the following data to the next module:");

相关文章