1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.logging.impl;
  17. import java.io.Serializable;
  18. import org.apache.commons.logging.Log;
  19. /**
  20. * <p>Trivial implementation of Log that throws away all messages. No
  21. * configurable system properties are supported.</p>
  22. *
  23. * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
  24. * @author Rod Waldhoff
  25. * @version $Id: NoOpLog.java,v 1.8 2004/06/06 21:13:12 rdonkin Exp $
  26. */
  27. public class NoOpLog implements Log, Serializable {
  28. /** Convenience constructor */
  29. public NoOpLog() { }
  30. /** Base constructor */
  31. public NoOpLog(String name) { }
  32. /** Do nothing */
  33. public void trace(Object message) { }
  34. /** Do nothing */
  35. public void trace(Object message, Throwable t) { }
  36. /** Do nothing */
  37. public void debug(Object message) { }
  38. /** Do nothing */
  39. public void debug(Object message, Throwable t) { }
  40. /** Do nothing */
  41. public void info(Object message) { }
  42. /** Do nothing */
  43. public void info(Object message, Throwable t) { }
  44. /** Do nothing */
  45. public void warn(Object message) { }
  46. /** Do nothing */
  47. public void warn(Object message, Throwable t) { }
  48. /** Do nothing */
  49. public void error(Object message) { }
  50. /** Do nothing */
  51. public void error(Object message, Throwable t) { }
  52. /** Do nothing */
  53. public void fatal(Object message) { }
  54. /** Do nothing */
  55. public void fatal(Object message, Throwable t) { }
  56. /**
  57. * Debug is never enabled.
  58. *
  59. * @return false
  60. */
  61. public final boolean isDebugEnabled() { return false; }
  62. /**
  63. * Error is never enabled.
  64. *
  65. * @return false
  66. */
  67. public final boolean isErrorEnabled() { return false; }
  68. /**
  69. * Fatal is never enabled.
  70. *
  71. * @return false
  72. */
  73. public final boolean isFatalEnabled() { return false; }
  74. /**
  75. * Info is never enabled.
  76. *
  77. * @return false
  78. */
  79. public final boolean isInfoEnabled() { return false; }
  80. /**
  81. * Trace is never enabled.
  82. *
  83. * @return false
  84. */
  85. public final boolean isTraceEnabled() { return false; }
  86. /**
  87. * Warn is never enabled.
  88. *
  89. * @return false
  90. */
  91. public final boolean isWarnEnabled() { return false; }
  92. }