Convert control statement bodies to block.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -74,8 +74,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @param name the name of the avalon logger implementation to delegate to
|
* @param name the name of the avalon logger implementation to delegate to
|
||||||
*/
|
*/
|
||||||
public AvalonLogger(String name) {
|
public AvalonLogger(String name) {
|
||||||
if (defaultLogger == null)
|
if (defaultLogger == null) {
|
||||||
throw new NullPointerException("default logger has to be specified if this constructor is used!");
|
throw new NullPointerException("default logger has to be specified if this constructor is used!");
|
||||||
|
}
|
||||||
this.logger = defaultLogger.getChildLogger(name);
|
this.logger = defaultLogger.getChildLogger(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +107,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#debug(Object, Throwable)
|
* @see org.apache.commons.logging.Log#debug(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void debug(Object message, Throwable t) {
|
public void debug(Object message, Throwable t) {
|
||||||
if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t);
|
if (getLogger().isDebugEnabled()) {
|
||||||
|
getLogger().debug(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +119,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#debug(Object)
|
* @see org.apache.commons.logging.Log#debug(Object)
|
||||||
*/
|
*/
|
||||||
public void debug(Object message) {
|
public void debug(Object message) {
|
||||||
if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message));
|
if (getLogger().isDebugEnabled()) {
|
||||||
|
getLogger().debug(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,7 +132,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#error(Object, Throwable)
|
* @see org.apache.commons.logging.Log#error(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void error(Object message, Throwable t) {
|
public void error(Object message, Throwable t) {
|
||||||
if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message), t);
|
if (getLogger().isErrorEnabled()) {
|
||||||
|
getLogger().error(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +144,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#error(Object)
|
* @see org.apache.commons.logging.Log#error(Object)
|
||||||
*/
|
*/
|
||||||
public void error(Object message) {
|
public void error(Object message) {
|
||||||
if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message));
|
if (getLogger().isErrorEnabled()) {
|
||||||
|
getLogger().error(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,7 +157,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#fatal(Object, Throwable)
|
* @see org.apache.commons.logging.Log#fatal(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void fatal(Object message, Throwable t) {
|
public void fatal(Object message, Throwable t) {
|
||||||
if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message), t);
|
if (getLogger().isFatalErrorEnabled()) {
|
||||||
|
getLogger().fatalError(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +169,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#fatal(Object)
|
* @see org.apache.commons.logging.Log#fatal(Object)
|
||||||
*/
|
*/
|
||||||
public void fatal(Object message) {
|
public void fatal(Object message) {
|
||||||
if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message));
|
if (getLogger().isFatalErrorEnabled()) {
|
||||||
|
getLogger().fatalError(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,7 +182,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#info(Object, Throwable)
|
* @see org.apache.commons.logging.Log#info(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void info(Object message, Throwable t) {
|
public void info(Object message, Throwable t) {
|
||||||
if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message), t);
|
if (getLogger().isInfoEnabled()) {
|
||||||
|
getLogger().info(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,7 +194,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#info(Object)
|
* @see org.apache.commons.logging.Log#info(Object)
|
||||||
*/
|
*/
|
||||||
public void info(Object message) {
|
public void info(Object message) {
|
||||||
if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message));
|
if (getLogger().isInfoEnabled()) {
|
||||||
|
getLogger().info(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,7 +255,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#trace(Object, Throwable)
|
* @see org.apache.commons.logging.Log#trace(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void trace(Object message, Throwable t) {
|
public void trace(Object message, Throwable t) {
|
||||||
if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t);
|
if (getLogger().isDebugEnabled()) {
|
||||||
|
getLogger().debug(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,7 +267,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#trace(Object)
|
* @see org.apache.commons.logging.Log#trace(Object)
|
||||||
*/
|
*/
|
||||||
public void trace(Object message) {
|
public void trace(Object message) {
|
||||||
if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message));
|
if (getLogger().isDebugEnabled()) {
|
||||||
|
getLogger().debug(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,7 +280,9 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#warn(Object, Throwable)
|
* @see org.apache.commons.logging.Log#warn(Object, Throwable)
|
||||||
*/
|
*/
|
||||||
public void warn(Object message, Throwable t) {
|
public void warn(Object message, Throwable t) {
|
||||||
if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message), t);
|
if (getLogger().isWarnEnabled()) {
|
||||||
|
getLogger().warn(String.valueOf(message), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,6 +292,8 @@ public class AvalonLogger implements Log {
|
|||||||
* @see org.apache.commons.logging.Log#warn(Object)
|
* @see org.apache.commons.logging.Log#warn(Object)
|
||||||
*/
|
*/
|
||||||
public void warn(Object message) {
|
public void warn(Object message) {
|
||||||
if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message));
|
if (getLogger().isWarnEnabled()) {
|
||||||
|
getLogger().warn(String.valueOf(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -739,8 +739,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
*/
|
*/
|
||||||
private boolean getBooleanConfiguration(String key, boolean dflt) {
|
private boolean getBooleanConfiguration(String key, boolean dflt) {
|
||||||
String val = getConfigurationValue(key);
|
String val = getConfigurationValue(key);
|
||||||
if (val == null)
|
if (val == null) {
|
||||||
return dflt;
|
return dflt;
|
||||||
|
}
|
||||||
return Boolean.valueOf(val).booleanValue();
|
return Boolean.valueOf(val).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1234,19 +1235,22 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
private ClassLoader getLowestClassLoader(ClassLoader c1, ClassLoader c2) {
|
private ClassLoader getLowestClassLoader(ClassLoader c1, ClassLoader c2) {
|
||||||
// TODO: use AccessController when dealing with classloaders here
|
// TODO: use AccessController when dealing with classloaders here
|
||||||
|
|
||||||
if (c1 == null)
|
if (c1 == null) {
|
||||||
return c2;
|
return c2;
|
||||||
|
}
|
||||||
|
|
||||||
if (c2 == null)
|
if (c2 == null) {
|
||||||
return c1;
|
return c1;
|
||||||
|
}
|
||||||
|
|
||||||
ClassLoader current;
|
ClassLoader current;
|
||||||
|
|
||||||
// scan c1's ancestors to find c2
|
// scan c1's ancestors to find c2
|
||||||
current = c1;
|
current = c1;
|
||||||
while (current != null) {
|
while (current != null) {
|
||||||
if (current == c2)
|
if (current == c2) {
|
||||||
return c1;
|
return c1;
|
||||||
|
}
|
||||||
// current = current.getParent();
|
// current = current.getParent();
|
||||||
current = getParentClassLoader(current);
|
current = getParentClassLoader(current);
|
||||||
}
|
}
|
||||||
@@ -1254,8 +1258,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
// scan c2's ancestors to find c1
|
// scan c2's ancestors to find c1
|
||||||
current = c2;
|
current = c2;
|
||||||
while (current != null) {
|
while (current != null) {
|
||||||
if (current == c1)
|
if (current == c1) {
|
||||||
return c2;
|
return c2;
|
||||||
|
}
|
||||||
// current = current.getParent();
|
// current = current.getParent();
|
||||||
current = getParentClassLoader(current);
|
current = getParentClassLoader(current);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ public class TestAppender extends AppenderSkeleton {
|
|||||||
|
|
||||||
lev.level = event.getLevel().toString();
|
lev.level = event.getLevel().toString();
|
||||||
|
|
||||||
if (event.getMessage() == null)
|
if (event.getMessage() == null) {
|
||||||
lev.msg = null;
|
lev.msg = null;
|
||||||
else
|
} else {
|
||||||
lev.msg = event.getMessage().toString();
|
lev.msg = event.getMessage().toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getThrowableInformation() == null)
|
if (event.getThrowableInformation() == null) {
|
||||||
lev.throwable = null;
|
lev.throwable = null;
|
||||||
else
|
} else {
|
||||||
lev.throwable = event.getThrowableInformation().getThrowable();
|
lev.throwable = event.getThrowableInformation().getThrowable();
|
||||||
|
}
|
||||||
|
|
||||||
events.add(lev);
|
events.add(lev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user