* developers to write log calls, while simultaneously making those
* calls as cheap as possible by performing lazy evaluation of the log
* message.<p>
- *
- * @author Marc Johnson (mjohnson at apache dot org)
- * @author Glen Stampoultzis (glens at apache.org)
- * @author Nicola Ken Barozzi (nicolaken at apache.org)
*/
-
public class CommonsLogger extends POILogger
{
-
private static LogFactory _creator = LogFactory.getFactory();
private Log log = null;
-
+ @Override
public void initialize(final String cat)
{
this.log = _creator.getInstance(cat);
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
* @param obj1 The object to log.
*/
+ @Override
public void log(final int level, final Object obj1)
{
if(level==FATAL)
* @param obj1 The object to log. This is converted to a string.
* @param exception An exception to be logged
*/
+ @Override
public void log(final int level, final Object obj1,
final Throwable exception)
{
*
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
*/
-
+ @Override
public boolean check(final int level)
{
if(level==FATAL)
* developers to write log calls, while simultaneously making those
* calls as cheap as possible by performing lazy evaluation of the log
* message.<p>
- *
- * @author Marc Johnson (mjohnson at apache dot org)
- * @author Glen Stampoultzis (glens at apache.org)
- * @author Nicola Ken Barozzi (nicolaken at apache.org)
*/
public class NullLogger extends POILogger {
@Override
- public void initialize(final String cat){
+ public void initialize(final String cat) {
// do nothing
}
*/
@Override
- public void log(final int level, final Object obj1)
- {
+ public void log(final int level, final Object obj1) {
// do nothing
}
* @param obj1 The object to log. This is converted to a string.
* @param exception An exception to be logged
*/
+ @Override
public void log(int level, Object obj1, final Throwable exception) {
// do nothing
}
* developers to write log calls, while simultaneously making those
* calls as cheap as possible by performing lazy evaluation of the log
* message.
- *
- * @author Marc Johnson (mjohnson at apache dot org)
- * @author Glen Stampoultzis (glens at apache.org)
- * @author Nicola Ken Barozzi (nicolaken at apache.org)
*/
public class SystemOutLogger extends POILogger
{
private String _cat;
+ @Override
public void initialize(final String cat)
{
this._cat=cat;
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
* @param obj1 The object to log.
*/
-
+ @Override
public void log(final int level, final Object obj1)
{
log(level, obj1, null);
* @param obj1 The object to log. This is converted to a string.
* @param exception An exception to be logged
*/
+ @Override
@SuppressForbidden("uses printStackTrace")
public void log(final int level, final Object obj1,
final Throwable exception) {
* @see #ERROR
* @see #FATAL
*/
+ @Override
public boolean check(final int level)
{
int currentLevel;
logged = new ArrayList<String>();
}
+ @Override
public boolean check(int level) {
return true;
}
+ @Override
public void initialize(String cat) {}
+ @Override
public void log(int level, Object obj1) {
logged.add(level + " - " + obj1);
}
+ @Override
public void log(int level, Object obj1, Throwable exception) {
logged.add(level + " - " + obj1 + " - " + exception);
}
/**
* Tests the log class.
- *
- * @author Glen Stampoultzis (glens at apache.org)
- * @author Marc Johnson (mjohnson at apache dot org)
- * @author Nicola Ken Barozzi (nicolaken at apache.org)
*/
public final class TestPOILogger extends POILogger {
private String lastLog = "";
POILogFactory._loggerClassName = oldLCN;
}
}
+
+ // ---------- POI Logger methods implemented for testing ----------
+ @Override
public void initialize(String cat) {
}
+ @Override
public void log(int level, Object obj1) {
lastLog = (obj1 == null) ? "" : obj1.toString();
lastEx = null;
}
+ @Override
public void log(int level, Object obj1, Throwable exception) {
lastLog = (obj1 == null) ? "" : obj1.toString();
lastEx = exception;
}
+ @Override
public boolean check(int level) {
return true;
}