Skip to content

Commit 1f3967c

Browse files
committed
spring-jcl provides NoOpLog and SimpleLog as well
Issue: SPR-15957
1 parent 825449a commit 1f3967c

File tree

6 files changed

+272
-125
lines changed

6 files changed

+272
-125
lines changed

spring-jcl/src/main/java/org/apache/commons/logging/Log.java

Lines changed: 103 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* instantiated successfully by {@link LogFactory}, classes that implement
2323
* this interface must have a constructor that takes a single String
2424
* parameter representing the "name" of this Log.
25-
* <p>
26-
* The six logging levels used by <code>Log</code> are (in order):
25+
*
26+
* <p>The six logging levels used by <code>Log</code> are (in order):
2727
* <ol>
2828
* <li>trace (the least serious)</li>
2929
* <li>debug</li>
@@ -32,185 +32,165 @@
3232
* <li>error</li>
3333
* <li>fatal (the most serious)</li>
3434
* </ol>
35+
*
3536
* The mapping of these log levels to the concepts used by the underlying
3637
* logging system is implementation dependent.
3738
* The implementation should ensure, though, that this ordering behaves
3839
* as expected.
39-
* <p>
40-
* Performance is often a logging concern.
40+
*
41+
* <p>Performance is often a logging concern.
4142
* By examining the appropriate property,
4243
* a component can avoid expensive operations (producing information
4344
* to be logged).
44-
* <p>
45-
* For example,
45+
*
46+
* <p>For example,
4647
* <pre>
4748
* if (log.isDebugEnabled()) {
4849
* ... do something expensive ...
4950
* log.debug(theResult);
5051
* }
5152
* </pre>
52-
* <p>
53-
* Configuration of the underlying logging system will generally be done
53+
*
54+
* <p>Configuration of the underlying logging system will generally be done
5455
* external to the Logging APIs, through whatever mechanism is supported by
5556
* that system.
5657
*
57-
* @version $Id: Log.java 1606045 2014-06-27 12:11:56Z tn $
58+
* @author Juergen Hoeller (for the {@code spring-jcl} variant)
59+
* @since 5.0
5860
*/
5961
public interface Log {
6062

61-
/**
62-
* Logs a message with debug log level.
63-
*
64-
* @param message log this message
65-
*/
66-
void debug(Object message);
67-
68-
/**
69-
* Logs an error with debug log level.
70-
*
71-
* @param message log this message
72-
* @param t log this cause
73-
*/
74-
void debug(Object message, Throwable t);
75-
76-
/**
63+
/**
64+
* Is fatal logging currently enabled?
65+
* <p>Call this method to prevent having to perform expensive operations
66+
* (for example, <code>String</code> concatenation)
67+
* when the log level is more than fatal.
68+
* @return true if fatal is enabled in the underlying logger.
69+
*/
70+
boolean isFatalEnabled();
71+
72+
/**
73+
* Is error logging currently enabled?
74+
* <p>Call this method to prevent having to perform expensive operations
75+
* (for example, <code>String</code> concatenation)
76+
* when the log level is more than error.
77+
* @return true if error is enabled in the underlying logger.
78+
*/
79+
boolean isErrorEnabled();
80+
81+
/**
82+
* Is warn logging currently enabled?
83+
* <p>Call this method to prevent having to perform expensive operations
84+
* (for example, <code>String</code> concatenation)
85+
* when the log level is more than warn.
86+
* @return true if warn is enabled in the underlying logger.
87+
*/
88+
boolean isWarnEnabled();
89+
90+
/**
91+
* Is info logging currently enabled?
92+
* <p>Call this method to prevent having to perform expensive operations
93+
* (for example, <code>String</code> concatenation)
94+
* when the log level is more than info.
95+
* @return true if info is enabled in the underlying logger.
96+
*/
97+
boolean isInfoEnabled();
98+
99+
/**
100+
* Is debug logging currently enabled?
101+
* <p>Call this method to prevent having to perform expensive operations
102+
* (for example, <code>String</code> concatenation)
103+
* when the log level is more than debug.
104+
* @return true if debug is enabled in the underlying logger.
105+
*/
106+
boolean isDebugEnabled();
107+
108+
/**
109+
* Is trace logging currently enabled?
110+
* <p>Call this method to prevent having to perform expensive operations
111+
* (for example, <code>String</code> concatenation)
112+
* when the log level is more than trace.
113+
* @return true if trace is enabled in the underlying logger.
114+
*/
115+
boolean isTraceEnabled();
116+
117+
118+
/**
119+
* Logs a message with fatal log level.
120+
* @param message log this message
121+
*/
122+
void fatal(Object message);
123+
124+
/**
125+
* Logs an error with fatal log level.
126+
* @param message log this message
127+
* @param t log this cause
128+
*/
129+
void fatal(Object message, Throwable t);
130+
131+
/**
77132
* Logs a message with error log level.
78-
*
79133
* @param message log this message
80134
*/
81135
void error(Object message);
82136

83137
/**
84138
* Logs an error with error log level.
85-
*
86139
* @param message log this message
87140
* @param t log this cause
88141
*/
89142
void error(Object message, Throwable t);
90143

91-
/**
92-
* Logs a message with fatal log level.
93-
*
94-
* @param message log this message
95-
*/
96-
void fatal(Object message);
144+
/**
145+
* Logs a message with warn log level.
146+
* @param message log this message
147+
*/
148+
void warn(Object message);
97149

98-
/**
99-
* Logs an error with fatal log level.
100-
*
101-
* @param message log this message
102-
* @param t log this cause
103-
*/
104-
void fatal(Object message, Throwable t);
150+
/**
151+
* Logs an error with warn log level.
152+
* @param message log this message
153+
* @param t log this cause
154+
*/
155+
void warn(Object message, Throwable t);
105156

106157
/**
107158
* Logs a message with info log level.
108-
*
109159
* @param message log this message
110160
*/
111161
void info(Object message);
112162

113163
/**
114164
* Logs an error with info log level.
115-
*
116165
* @param message log this message
117166
* @param t log this cause
118167
*/
119168
void info(Object message, Throwable t);
120169

121-
/**
122-
* Is debug logging currently enabled?
123-
* <p>
124-
* Call this method to prevent having to perform expensive operations
125-
* (for example, <code>String</code> concatenation)
126-
* when the log level is more than debug.
127-
*
128-
* @return true if debug is enabled in the underlying logger.
129-
*/
130-
boolean isDebugEnabled();
170+
/**
171+
* Logs a message with debug log level.
172+
* @param message log this message
173+
*/
174+
void debug(Object message);
131175

132-
/**
133-
* Is error logging currently enabled?
134-
* <p>
135-
* Call this method to prevent having to perform expensive operations
136-
* (for example, <code>String</code> concatenation)
137-
* when the log level is more than error.
138-
*
139-
* @return true if error is enabled in the underlying logger.
140-
*/
141-
boolean isErrorEnabled();
142-
143-
/**
144-
* Is fatal logging currently enabled?
145-
* <p>
146-
* Call this method to prevent having to perform expensive operations
147-
* (for example, <code>String</code> concatenation)
148-
* when the log level is more than fatal.
149-
*
150-
* @return true if fatal is enabled in the underlying logger.
151-
*/
152-
boolean isFatalEnabled();
153-
154-
/**
155-
* Is info logging currently enabled?
156-
* <p>
157-
* Call this method to prevent having to perform expensive operations
158-
* (for example, <code>String</code> concatenation)
159-
* when the log level is more than info.
160-
*
161-
* @return true if info is enabled in the underlying logger.
162-
*/
163-
boolean isInfoEnabled();
164-
165-
/**
166-
* Is trace logging currently enabled?
167-
* <p>
168-
* Call this method to prevent having to perform expensive operations
169-
* (for example, <code>String</code> concatenation)
170-
* when the log level is more than trace.
171-
*
172-
* @return true if trace is enabled in the underlying logger.
173-
*/
174-
boolean isTraceEnabled();
176+
/**
177+
* Logs an error with debug log level.
178+
* @param message log this message
179+
* @param t log this cause
180+
*/
181+
void debug(Object message, Throwable t);
175182

176-
/**
177-
* Is warn logging currently enabled?
178-
* <p>
179-
* Call this method to prevent having to perform expensive operations
180-
* (for example, <code>String</code> concatenation)
181-
* when the log level is more than warn.
182-
*
183-
* @return true if warn is enabled in the underlying logger.
184-
*/
185-
boolean isWarnEnabled();
186-
187-
/**
183+
/**
188184
* Logs a message with trace log level.
189-
*
190185
* @param message log this message
191186
*/
192187
void trace(Object message);
193188

194189
/**
195190
* Logs an error with trace log level.
196-
*
197191
* @param message log this message
198192
* @param t log this cause
199193
*/
200194
void trace(Object message, Throwable t);
201195

202-
/**
203-
* Logs a message with warn log level.
204-
*
205-
* @param message log this message
206-
*/
207-
void warn(Object message);
208-
209-
/**
210-
* Logs an error with warn log level.
211-
*
212-
* @param message log this message
213-
* @param t log this cause
214-
*/
215-
void warn(Object message, Throwable t);
216196
}

spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
* (or another SLF4J provider) onto your classpath, without any extra bridges,
5858
* and let the framework auto-adapt to your choice.
5959
*
60-
* @author Juergen Hoeller
60+
* @author Juergen Hoeller (for the {@code spring-jcl} variant)
6161
* @since 5.0
6262
*/
6363
public abstract class LogFactory {

0 commit comments

Comments
 (0)