Replace tab characters with spaces. No other changes.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@581090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1092,7 +1092,7 @@ public abstract class LogFactory {
|
||||
*/
|
||||
protected static LogFactory newFactory(final String factoryClass,
|
||||
final ClassLoader classLoader) {
|
||||
return newFactory(factoryClass, classLoader, null);
|
||||
return newFactory(factoryClass, classLoader, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1182,7 +1182,7 @@ public abstract class LogFactory {
|
||||
// loading with that loader (not the TCCL). Just throw an
|
||||
// appropriate exception here.
|
||||
|
||||
final boolean implementsLogFactory = implementsLogFactory(logFactoryClass);
|
||||
final boolean implementsLogFactory = implementsLogFactory(logFactoryClass);
|
||||
|
||||
//
|
||||
// Construct a good message: users may not actual expect that a custom implementation
|
||||
@@ -1195,13 +1195,13 @@ public abstract class LogFactory {
|
||||
+ LogFactory.class.getName() + "'. ";
|
||||
if (implementsLogFactory) {
|
||||
msg = msg + "The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders. " +
|
||||
"Background can be found in http://commons.apache.org/logging/tech.html. " +
|
||||
"If you have not explicitly specified a custom LogFactory then it is likely that " +
|
||||
"the container has set one without your knowledge. " +
|
||||
"In this case, consider using the commons-logging-adapters.jar file or " +
|
||||
"specifying the standard LogFactory from the command line. ";
|
||||
"Background can be found in http://commons.apache.org/logging/tech.html. " +
|
||||
"If you have not explicitly specified a custom LogFactory then it is likely that " +
|
||||
"the container has set one without your knowledge. " +
|
||||
"In this case, consider using the commons-logging-adapters.jar file or " +
|
||||
"specifying the standard LogFactory from the command line. ";
|
||||
} else {
|
||||
msg = msg + "Please check the custom implementation. ";
|
||||
msg = msg + "Please check the custom implementation. ";
|
||||
}
|
||||
msg = msg + "Help can be found @http://commons.apache.org/logging/troubleshooting.html.";
|
||||
|
||||
@@ -1563,31 +1563,31 @@ public abstract class LogFactory {
|
||||
*/
|
||||
private static void initDiagnostics() {
|
||||
String dest;
|
||||
try {
|
||||
dest = getSystemProperty(DIAGNOSTICS_DEST_PROPERTY, null);
|
||||
if (dest == null) {
|
||||
return;
|
||||
}
|
||||
} catch(SecurityException ex) {
|
||||
// We must be running in some very secure environment.
|
||||
// We just have to assume output is not wanted..
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest.equals("STDOUT")) {
|
||||
diagnosticsStream = System.out;
|
||||
} else if (dest.equals("STDERR")) {
|
||||
diagnosticsStream = System.err;
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
dest = getSystemProperty(DIAGNOSTICS_DEST_PROPERTY, null);
|
||||
if (dest == null) {
|
||||
return;
|
||||
}
|
||||
} catch(SecurityException ex) {
|
||||
// We must be running in some very secure environment.
|
||||
// We just have to assume output is not wanted..
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest.equals("STDOUT")) {
|
||||
diagnosticsStream = System.out;
|
||||
} else if (dest.equals("STDERR")) {
|
||||
diagnosticsStream = System.err;
|
||||
} else {
|
||||
try {
|
||||
// open the file in append mode
|
||||
FileOutputStream fos = new FileOutputStream(dest, true);
|
||||
diagnosticsStream = new PrintStream(fos);
|
||||
} catch(IOException ex) {
|
||||
// We should report this to the user - but how?
|
||||
return;
|
||||
}
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(dest, true);
|
||||
diagnosticsStream = new PrintStream(fos);
|
||||
} catch(IOException ex) {
|
||||
// We should report this to the user - but how?
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// In order to avoid confusion where multiple instances of JCL are
|
||||
// being used via different classloaders within the same app, we
|
||||
|
||||
@@ -1364,9 +1364,9 @@ public class LogFactoryImpl extends LogFactory {
|
||||
+ discoveryFlaw.getLocalizedMessage());
|
||||
|
||||
if (discoveryFlaw instanceof InvocationTargetException ) {
|
||||
// Ok, the lib is there but while trying to create a real underlying
|
||||
// logger something failed in the underlying lib; display info about
|
||||
// that if possible.
|
||||
// Ok, the lib is there but while trying to create a real underlying
|
||||
// logger something failed in the underlying lib; display info about
|
||||
// that if possible.
|
||||
InvocationTargetException ite = (InvocationTargetException)discoveryFlaw;
|
||||
Throwable cause = ite.getTargetException();
|
||||
if (cause != null) {
|
||||
|
||||
@@ -137,11 +137,11 @@ public class SimpleLog implements Log, Serializable {
|
||||
|
||||
private static String getStringProperty(String name) {
|
||||
String prop = null;
|
||||
try {
|
||||
prop = System.getProperty(name);
|
||||
} catch (SecurityException e) {
|
||||
; // Ignore
|
||||
}
|
||||
try {
|
||||
prop = System.getProperty(name);
|
||||
} catch (SecurityException e) {
|
||||
; // Ignore
|
||||
}
|
||||
return (prop == null) ? simpleLogProps.getProperty(name) : prop;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
}
|
||||
|
||||
// Append the name of the log instance if so configured
|
||||
if( showShortName) {
|
||||
if( showShortName) {
|
||||
if( shortLogName==null ) {
|
||||
// Cut all but the last component of the name for both styles
|
||||
shortLogName = logName.substring(logName.lastIndexOf(".") + 1);
|
||||
|
||||
@@ -33,64 +33,64 @@ public abstract class AbstractLogTest extends TestCase {
|
||||
|
||||
public abstract Log getLogObject();
|
||||
|
||||
public void testLoggingWithNullParameters()
|
||||
{
|
||||
Log log = this.getLogObject();
|
||||
|
||||
assertNotNull(log);
|
||||
|
||||
public void testLoggingWithNullParameters()
|
||||
{
|
||||
Log log = this.getLogObject();
|
||||
|
||||
log.debug(null);
|
||||
|
||||
log.debug(null, null);
|
||||
|
||||
log.debug(log.getClass().getName() + ": debug statement");
|
||||
|
||||
log.debug(log.getClass().getName() + ": debug statement w/ null exception", new RuntimeException());
|
||||
|
||||
assertNotNull(log);
|
||||
|
||||
log.error(null);
|
||||
|
||||
log.error(null, null);
|
||||
|
||||
log.error(log.getClass().getName() + ": error statement");
|
||||
|
||||
log.error(log.getClass().getName() + ": error statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.fatal(null);
|
||||
|
||||
log.fatal(null, null);
|
||||
|
||||
log.fatal(log.getClass().getName() + ": fatal statement");
|
||||
|
||||
log.fatal(log.getClass().getName() + ": fatal statement w/ null exception", new RuntimeException());
|
||||
|
||||
log.debug(null);
|
||||
|
||||
log.info(null);
|
||||
|
||||
log.info(null, null);
|
||||
|
||||
log.info(log.getClass().getName() + ": info statement");
|
||||
|
||||
log.info(log.getClass().getName() + ": info statement w/ null exception", new RuntimeException());
|
||||
|
||||
log.debug(null, null);
|
||||
|
||||
log.trace(null);
|
||||
|
||||
log.trace(null, null);
|
||||
|
||||
log.trace(log.getClass().getName() + ": trace statement");
|
||||
|
||||
log.trace(log.getClass().getName() + ": trace statement w/ null exception", new RuntimeException());
|
||||
|
||||
log.debug(log.getClass().getName() + ": debug statement");
|
||||
|
||||
log.warn(null);
|
||||
|
||||
log.warn(null, null);
|
||||
|
||||
log.warn(log.getClass().getName() + ": warn statement");
|
||||
|
||||
log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
|
||||
}
|
||||
log.debug(log.getClass().getName() + ": debug statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.error(null);
|
||||
|
||||
log.error(null, null);
|
||||
|
||||
log.error(log.getClass().getName() + ": error statement");
|
||||
|
||||
log.error(log.getClass().getName() + ": error statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.fatal(null);
|
||||
|
||||
log.fatal(null, null);
|
||||
|
||||
log.fatal(log.getClass().getName() + ": fatal statement");
|
||||
|
||||
log.fatal(log.getClass().getName() + ": fatal statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.info(null);
|
||||
|
||||
log.info(null, null);
|
||||
|
||||
log.info(log.getClass().getName() + ": info statement");
|
||||
|
||||
log.info(log.getClass().getName() + ": info statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.trace(null);
|
||||
|
||||
log.trace(null, null);
|
||||
|
||||
log.trace(log.getClass().getName() + ": trace statement");
|
||||
|
||||
log.trace(log.getClass().getName() + ": trace statement w/ null exception", new RuntimeException());
|
||||
|
||||
|
||||
log.warn(null);
|
||||
|
||||
log.warn(null, null);
|
||||
|
||||
log.warn(log.getClass().getName() + ": warn statement");
|
||||
|
||||
log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ import org.apache.commons.logging.impl.SimpleLog;
|
||||
*/
|
||||
public class SimpleLogTestCase extends AbstractLogTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public Log getLogObject()
|
||||
{
|
||||
return (Log) new SimpleLog(this.getClass().getName());
|
||||
@@ -41,6 +41,6 @@ public class SimpleLogTestCase extends AbstractLogTest
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] testCaseName = { SimpleLogTestCase.class.getName() };
|
||||
junit.textui.TestRunner.main(testCaseName);
|
||||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AvalonLoggerTestCase extends AbstractLogTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] testCaseName = { AvalonLoggerTestCase.class.getName() };
|
||||
junit.textui.TestRunner.main(testCaseName);
|
||||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
@@ -43,6 +43,6 @@ public class AvalonLoggerTestCase extends AbstractLogTest {
|
||||
|
||||
public Log getLogObject() {
|
||||
Log log = new AvalonLogger(new ConsoleLogger());
|
||||
return log;
|
||||
}
|
||||
return log;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,13 @@ public class NoOpLogTestCase extends AbstractLogTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the abstract method from the parent class so that the
|
||||
* Override the abstract method from the parent class so that the
|
||||
* inherited tests can access the right Log object type.
|
||||
*/
|
||||
public Log getLogObject()
|
||||
{
|
||||
return (Log) new NoOpLog(this.getClass().getName());
|
||||
}
|
||||
*/
|
||||
public Log getLogObject()
|
||||
{
|
||||
return (Log) new NoOpLog(this.getClass().getName());
|
||||
}
|
||||
|
||||
// Test Serializability of standard instance
|
||||
public void testSerializable() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user