PageRenderTime 42ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/apache-log4j-1.2.17/src/main/java/org/apache/log4j/spi/NOPLoggerRepository.java

#
Java | 131 lines | 47 code | 18 blank | 66 comment | 0 complexity | 47b2a2e15b37ff76c7a29872817096f0 MD5 | raw file
Possible License(s): Apache-2.0
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package org.apache.log4j.spi;
  18. import org.apache.log4j.Level;
  19. import org.apache.log4j.Category;
  20. import org.apache.log4j.Logger;
  21. import org.apache.log4j.Appender;
  22. import java.util.Enumeration;
  23. import java.util.Vector;
  24. /**
  25. * No-operation implementation of LoggerRepository which is used when
  26. * LogManager.repositorySelector is erroneously nulled during class reloading.
  27. * @since 1.2.15
  28. */
  29. public final class NOPLoggerRepository implements LoggerRepository {
  30. /**
  31. * {@inheritDoc}
  32. */
  33. public void addHierarchyEventListener(final HierarchyEventListener listener) {
  34. }
  35. /**
  36. * {@inheritDoc}
  37. */
  38. public boolean isDisabled(final int level) {
  39. return true;
  40. }
  41. /**
  42. * {@inheritDoc}
  43. */
  44. public void setThreshold(final Level level) {
  45. }
  46. /**
  47. * {@inheritDoc}
  48. */
  49. public void setThreshold(final String val) {
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public void emitNoAppenderWarning(final Category cat) {
  55. }
  56. /**
  57. * {@inheritDoc}
  58. */
  59. public Level getThreshold() {
  60. return Level.OFF;
  61. }
  62. /**
  63. * {@inheritDoc}
  64. */
  65. public Logger getLogger(final String name) {
  66. return new NOPLogger(this, name);
  67. }
  68. /**
  69. * {@inheritDoc}
  70. */
  71. public Logger getLogger(final String name, final LoggerFactory factory) {
  72. return new NOPLogger(this, name);
  73. }
  74. /**
  75. * {@inheritDoc}
  76. */
  77. public Logger getRootLogger() {
  78. return new NOPLogger(this, "root");
  79. }
  80. /**
  81. * {@inheritDoc}
  82. */
  83. public Logger exists(final String name) {
  84. return null;
  85. }
  86. /**
  87. * {@inheritDoc}
  88. */
  89. public void shutdown() {
  90. }
  91. /**
  92. * {@inheritDoc}
  93. */
  94. public Enumeration getCurrentLoggers() {
  95. return new Vector().elements();
  96. }
  97. /**
  98. * {@inheritDoc}
  99. */
  100. public Enumeration getCurrentCategories() {
  101. return getCurrentLoggers();
  102. }
  103. /**
  104. * {@inheritDoc}
  105. */
  106. public void fireAddAppenderEvent(Category logger, Appender appender) {
  107. }
  108. /**
  109. * {@inheritDoc}
  110. */
  111. public void resetConfiguration() {
  112. }
  113. }