1 16 17 package org.apache.commons.logging.impl; 18 19 20 import java.lang.reflect.Constructor ; 21 import java.lang.reflect.InvocationTargetException ; 22 import java.lang.reflect.Method ; 23 import java.net.URL ; 24 import java.util.Enumeration ; 25 import java.util.Hashtable ; 26 import java.util.Vector ; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogConfigurationException; 30 import org.apache.commons.logging.LogFactory; 31 32 33 67 68 public class LogFactoryImpl extends LogFactory { 69 70 71 72 private static final String LOGGING_IMPL_LOG4J_LOGGER = "org.apache.commons.logging.impl.Log4JLogger"; 73 74 private static final String LOGGING_IMPL_JDK14_LOGGER = "org.apache.commons.logging.impl.Jdk14Logger"; 75 76 private static final String LOGGING_IMPL_LUMBERJACK_LOGGER = "org.apache.commons.logging.impl.Jdk13LumberjackLogger"; 77 78 private static final String LOGGING_IMPL_SIMPLE_LOGGER = "org.apache.commons.logging.impl.SimpleLog"; 79 80 private static final String PKG_IMPL="org.apache.commons.logging.impl."; 81 private static final int PKG_LEN = PKG_IMPL.length(); 82 83 85 86 87 90 public LogFactoryImpl() { 91 super(); 92 initDiagnostics(); if (isDiagnosticsEnabled()) { 94 logDiagnostic("Instance created."); 95 } 96 } 97 98 99 101 102 106 public static final String LOG_PROPERTY = 107 "org.apache.commons.logging.Log"; 108 109 110 114 protected static final String LOG_PROPERTY_OLD = 115 "org.apache.commons.logging.log"; 116 117 129 public static final String ALLOW_FLAWED_CONTEXT_PROPERTY = 130 "org.apache.commons.logging.Log.allowFlawedContext"; 131 132 145 public static final String ALLOW_FLAWED_DISCOVERY_PROPERTY = 146 "org.apache.commons.logging.Log.allowFlawedDiscovery"; 147 148 161 public static final String ALLOW_FLAWED_HIERARCHY_PROPERTY = 162 "org.apache.commons.logging.Log.allowFlawedHierarchy"; 163 164 165 173 private static final String [] classesToDiscover = { 174 LOGGING_IMPL_LOG4J_LOGGER, 175 "org.apache.commons.logging.impl.Jdk14Logger", 176 "org.apache.commons.logging.impl.Jdk13LumberjackLogger", 177 "org.apache.commons.logging.impl.SimpleLog" 178 }; 179 180 181 183 187 private boolean useTCCL = true; 188 189 192 private String diagnosticPrefix; 193 194 195 198 protected Hashtable attributes = new Hashtable (); 199 200 201 205 protected Hashtable instances = new Hashtable (); 206 207 208 211 private String logClassName; 212 213 214 221 protected Constructor logConstructor = null; 222 223 224 227 protected Class logConstructorSignature[] = 228 { java.lang.String .class }; 229 230 231 235 protected Method logMethod = null; 236 237 238 241 protected Class logMethodSignature[] = 242 { LogFactory.class }; 243 244 247 private boolean allowFlawedContext; 248 249 252 private boolean allowFlawedDiscovery; 253 254 257 private boolean allowFlawedHierarchy; 258 259 261 262 268 public Object getAttribute(String name) { 269 270 return (attributes.get(name)); 271 272 } 273 274 275 280 public String [] getAttributeNames() { 281 282 Vector names = new Vector (); 283 Enumeration keys = attributes.keys(); 284 while (keys.hasMoreElements()) { 285 names.addElement((String ) keys.nextElement()); 286 } 287 String results[] = new String [names.size()]; 288 for (int i = 0; i < results.length; i++) { 289 results[i] = (String ) names.elementAt(i); 290 } 291 return (results); 292 293 } 294 295 296 305 public Log getInstance(Class clazz) throws LogConfigurationException { 306 307 return (getInstance(clazz.getName())); 308 309 } 310 311 312 329 public Log getInstance(String name) throws LogConfigurationException { 330 331 Log instance = (Log) instances.get(name); 332 if (instance == null) { 333 instance = newInstance(name); 334 instances.put(name, instance); 335 } 336 return (instance); 337 338 } 339 340 341 349 public void release() { 350 351 logDiagnostic("Releasing all known loggers"); 352 instances.clear(); 353 } 354 355 356 362 public void removeAttribute(String name) { 363 364 attributes.remove(name); 365 366 } 367 368 369 393 public void setAttribute(String name, Object value) { 394 395 if (logConstructor != null) { 396 logDiagnostic("setAttribute: call too late; configuration already performed."); 397 } 398 399 if (value == null) { 400 attributes.remove(name); 401 } else { 402 attributes.put(name, value); 403 } 404 405 if (name.equals(TCCL_KEY)) { 406 useTCCL = Boolean.valueOf(value.toString()).booleanValue(); 407 } 408 409 } 410 411 412 419 424 protected static ClassLoader getContextClassLoader() throws LogConfigurationException { 425 return LogFactory.getContextClassLoader(); 426 } 427 428 429 433 protected static boolean isDiagnosticsEnabled() { 434 return LogFactory.isDiagnosticsEnabled(); 435 } 436 437 438 443 protected static ClassLoader getClassLoader(Class clazz) { 444 return LogFactory.getClassLoader(clazz); 445 } 446 447 448 450 462 private void initDiagnostics() { 463 Class clazz = this.getClass(); 473 ClassLoader classLoader = getClassLoader(clazz); 474 String classLoaderName; 475 try { 476 if (classLoader == null) { 477 classLoaderName = "BOOTLOADER"; 478 } else { 479 classLoaderName = objectId(classLoader); 480 } 481 } catch(SecurityException e) { 482 classLoaderName = "UNKNOWN"; 483 } 484 diagnosticPrefix = "[LogFactoryImpl@" + System.identityHashCode(this) + " from " + classLoaderName + "] "; 485 } 486 487 488 495 protected void logDiagnostic(String msg) { 496 if (isDiagnosticsEnabled()) { 497 logRawDiagnostic(diagnosticPrefix + msg); 498 } 499 } 500 501 508 protected String getLogClassName() { 509 510 if (logClassName == null) { 511 discoverLogImplementation(getClass().getName()); 512 } 513 514 return logClassName; 515 } 516 517 518 533 protected Constructor getLogConstructor() 534 throws LogConfigurationException { 535 536 if (logConstructor == null) { 538 discoverLogImplementation(getClass().getName()); 539 } 540 541 return logConstructor; 542 } 543 544 545 551 protected boolean isJdk13LumberjackAvailable() { 552 return isLogLibraryAvailable( 553 "Jdk13Lumberjack", 554 "org.apache.commons.logging.impl.Jdk13LumberjackLogger"); 555 } 556 557 558 567 protected boolean isJdk14Available() { 568 return isLogLibraryAvailable( 569 "Jdk14", 570 "org.apache.commons.logging.impl.Jdk14Logger"); 571 } 572 573 574 580 protected boolean isLog4JAvailable() { 581 return isLogLibraryAvailable( 582 "Log4J", 583 LOGGING_IMPL_LOG4J_LOGGER); 584 } 585 586 587 596 protected Log newInstance(String name) throws LogConfigurationException { 597 598 Log instance = null; 599 try { 600 if (logConstructor == null) { 601 instance = discoverLogImplementation(name); 602 } 603 else { 604 Object params[] = { name }; 605 instance = (Log) logConstructor.newInstance(params); 606 } 607 608 if (logMethod != null) { 609 Object params[] = { this }; 610 logMethod.invoke(instance, params); 611 } 612 613 return (instance); 614 615 } catch (LogConfigurationException lce) { 616 617 throw (LogConfigurationException) lce; 621 622 } catch (InvocationTargetException e) { 623 Throwable c = e.getTargetException(); 626 if (c != null) { 627 throw new LogConfigurationException(c); 628 } else { 629 throw new LogConfigurationException(e); 630 } 631 } catch (Throwable t) { 632 throw new LogConfigurationException(t); 635 } 636 } 637 638 639 641 646 private boolean isLogLibraryAvailable(String name, String classname) { 647 if (isDiagnosticsEnabled()) { 648 logDiagnostic("Checking for '" + name + "'."); 649 } 650 try { 651 Log log = createLogFromClass( 652 classname, 653 this.getClass().getName(), false); 655 656 if (log == null) { 657 if (isDiagnosticsEnabled()) { 658 logDiagnostic("Did not find '" + name + "'."); 659 } 660 return false; 661 } else { 662 if (isDiagnosticsEnabled()) { 663 logDiagnostic("Found '" + name + "'."); 664 } 665 return true; 666 } 667 } catch(LogConfigurationException e) { 668 if (isDiagnosticsEnabled()) { 669 logDiagnostic("Logging system '" + name + "' is available but not useable."); 670 } 671 return false; 672 } 673 } 674 675 686 private String getConfigurationValue(String property) { 687 if (isDiagnosticsEnabled()) { 688 logDiagnostic("[ENV] Trying to get configuration for item " + property); 689 } 690 691 Object valueObj = getAttribute(property); 692 if (valueObj != null) { 693 if (isDiagnosticsEnabled()) { 694 logDiagnostic("[ENV] Found LogFactory attribute [" + valueObj + "] for " + property); 695 } 696 return valueObj.toString(); 697 } 698 699 if (isDiagnosticsEnabled()) { 700 logDiagnostic("[ENV] No LogFactory attribute found for " + property); 701 } 702 703 try { 704 String value = System.getProperty(property); 705 if (value != null) { 706 if (isDiagnosticsEnabled()) { 707 logDiagnostic("[ENV] Found system property [" + value + "] for " + property); 708 } 709 return value; 710 } 711 712 if (isDiagnosticsEnabled()) { 713 logDiagnostic("[ENV] No system property found for property " + property); 714 } 715 } catch (SecurityException e) { 716 if (isDiagnosticsEnabled()) { 717 logDiagnostic("[ENV] Security prevented reading system property " + property); 718 } 719 } 720 721 if (isDiagnosticsEnabled()) { 722 logDiagnostic("[ENV] No configuration defined for item " + property); 723 } 724 725 return null; 726 } 727 728 732 private boolean getBooleanConfiguration(String key, boolean dflt) { 733 String val = getConfigurationValue(key); 734 if (val == null) 735 return dflt; 736 return Boolean.valueOf(val).booleanValue(); 737 } 738 739 746 private void initConfiguration() { 747 allowFlawedContext = getBooleanConfiguration(ALLOW_FLAWED_CONTEXT_PROPERTY, true); 748 allowFlawedDiscovery = getBooleanConfiguration(ALLOW_FLAWED_DISCOVERY_PROPERTY, true); 749 allowFlawedHierarchy = getBooleanConfiguration(ALLOW_FLAWED_HIERARCHY_PROPERTY, true); 750 } 751 752 753 762 private Log discoverLogImplementation(String logCategory) 763 throws LogConfigurationException 764 { 765 if (isDiagnosticsEnabled()) { 766 logDiagnostic("Discovering a Log implementation..."); 767 } 768 769 initConfiguration(); 770 771 Log result = null; 772 773 String specifiedLogClassName = findUserSpecifiedLogClassName(); 775 776 if (specifiedLogClassName != null) { 777 if (isDiagnosticsEnabled()) { 778 logDiagnostic("Attempting to load user-specified log class '" + 779 specifiedLogClassName + "'..."); 780 } 781 782 result = createLogFromClass(specifiedLogClassName, 783 logCategory, 784 true); 785 if (result == null) { 786 StringBuffer messageBuffer = new StringBuffer ("User-specified log class '"); 787 messageBuffer.append(specifiedLogClassName); 788 messageBuffer.append("' cannot be found or is not useable."); 789 790 if (specifiedLogClassName != null) { 793 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LOG4J_LOGGER); 794 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_JDK14_LOGGER); 795 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LUMBERJACK_LOGGER); 796 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_SIMPLE_LOGGER); 797 } 798 throw new LogConfigurationException(messageBuffer.toString()); 799 } 800 801 return result; 802 } 803 804 832 if (isDiagnosticsEnabled()) { 833 logDiagnostic( 834 "No user-specified Log implementation; performing discovery" + 835 " using the standard supported logging implementations..."); 836 } 837 for(int i=0; (i<classesToDiscover.length) && (result == null); ++i) { 838 result = createLogFromClass(classesToDiscover[i], logCategory, true); 839 } 840 841 if (result == null) { 842 throw new LogConfigurationException 843 ("No suitable Log implementation"); 844 } 845 846 return result; 847 } 848 849 850 857 private void informUponSimilarName(final StringBuffer messageBuffer, final String name, 858 final String candidate) { 859 if (name.equals(candidate)) { 860 return; 863 } 864 865 if (name.regionMatches(true, 0, candidate, 0, PKG_LEN + 5)) { 869 messageBuffer.append(" Did you mean '"); 870 messageBuffer.append(candidate); 871 messageBuffer.append("'?"); 872 } 873 } 874 875 876 883 private String findUserSpecifiedLogClassName() 884 { 885 if (isDiagnosticsEnabled()) { 886 logDiagnostic("Trying to get log class from attribute '" + LOG_PROPERTY + "'"); 887 } 888 String specifiedClass = (String ) getAttribute(LOG_PROPERTY); 889 890 if (specifiedClass == null) { if (isDiagnosticsEnabled()) { 892 logDiagnostic("Trying to get log class from attribute '" + 893 LOG_PROPERTY_OLD + "'"); 894 } 895 specifiedClass = (String ) getAttribute(LOG_PROPERTY_OLD); 896 } 897 898 if (specifiedClass == null) { 899 if (isDiagnosticsEnabled()) { 900 logDiagnostic("Trying to get log class from system property '" + 901 LOG_PROPERTY + "'"); 902 } 903 try { 904 specifiedClass = System.getProperty(LOG_PROPERTY); 905 } catch (SecurityException e) { 906 if (isDiagnosticsEnabled()) { 907 logDiagnostic("No access allowed to system property '" + 908 LOG_PROPERTY + "' - " + e.getMessage()); 909 } 910 } 911 } 912 913 if (specifiedClass == null) { if (isDiagnosticsEnabled()) { 915 logDiagnostic("Trying to get log class from system property '" + 916 LOG_PROPERTY_OLD + "'"); 917 } 918 try { 919 specifiedClass = System.getProperty(LOG_PROPERTY_OLD); 920 } catch (SecurityException e) { 921 if (isDiagnosticsEnabled()) { 922 logDiagnostic("No access allowed to system property '" + 923 LOG_PROPERTY_OLD + "' - " + e.getMessage()); 924 } 925 } 926 } 927 928 if (specifiedClass != null) { 932 specifiedClass = specifiedClass.trim(); 933 } 934 935 return specifiedClass; 936 } 937 938 939 958 private Log createLogFromClass(String logAdapterClassName, 959 String logCategory, 960 boolean affectState) 961 throws LogConfigurationException { 962 963 if (isDiagnosticsEnabled()) { 964 logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); 965 } 966 967 Object [] params = { logCategory }; 968 Log logAdapter = null; 969 Constructor constructor = null; 970 971 Class logAdapterClass = null; 972 ClassLoader currentCL = getBaseClassLoader(); 973 974 for(;;) { 975 logDiagnostic( 978 "Trying to load '" 979 + logAdapterClassName 980 + "' from classloader " 981 + objectId(currentCL)); 982 try { 983 if (isDiagnosticsEnabled()) { 984 URL url; 989 String resourceName = logAdapterClassName.replace('.', '/') + ".class"; 990 if (currentCL != null) { 991 url = currentCL.getResource(resourceName ); 992 } else { 993 url = ClassLoader.getSystemResource(resourceName + ".class"); 994 } 995 996 if (url == null) { 997 logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); 998 } else { 999 logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); 1000 } 1001 } 1002 1003 Class c = null; 1004 try { 1005 c = Class.forName(logAdapterClassName, true, currentCL); 1006 } catch (ClassNotFoundException originalClassNotFoundException) { 1007 String msg = "" + originalClassNotFoundException.getMessage(); 1011 logDiagnostic( 1012 "The log adapter '" 1013 + logAdapterClassName 1014 + "' is not available via classloader " 1015 + objectId(currentCL) 1016 + ": " 1017 + msg.trim()); 1018 try { 1019 c = Class.forName(logAdapterClassName); 1027 } catch (ClassNotFoundException secondaryClassNotFoundException) { 1028 msg = "" + secondaryClassNotFoundException.getMessage(); 1030 logDiagnostic( 1031 "The log adapter '" 1032 + logAdapterClassName 1033 + "' is not available via the LogFactoryImpl class classloader: " 1034 + msg.trim()); 1035 break; 1036 } 1037 } 1038 1039 constructor = c.getConstructor(logConstructorSignature); 1040 Object o = constructor.newInstance(params); 1041 1042 if (o instanceof Log) { 1047 logAdapterClass = c; 1048 logAdapter = (Log) o; 1049 break; 1050 } 1051 1052 handleFlawedHierarchy(currentCL, c); 1063 } catch (NoClassDefFoundError e) { 1064 String msg = "" + e.getMessage(); 1070 logDiagnostic( 1071 "The log adapter '" 1072 + logAdapterClassName 1073 + "' is missing dependencies when loaded via classloader " 1074 + objectId(currentCL) 1075 + ": " 1076 + msg.trim()); 1077 break; 1078 } catch (ExceptionInInitializerError e) { 1079 String msg = "" + e.getMessage(); 1086 logDiagnostic( 1087 "The log adapter '" 1088 + logAdapterClassName 1089 + "' is unable to initialize itself when loaded via classloader " 1090 + objectId(currentCL) 1091 + ": " 1092 + msg.trim()); 1093 break; 1094 } catch(LogConfigurationException e) { 1095 throw e; 1098 } catch(Throwable t) { 1099 handleFlawedDiscovery(logAdapterClassName, currentCL, t); 1103 } 1104 1105 if (currentCL == null) { 1106 break; 1107 } 1108 1109 currentCL = currentCL.getParent(); 1111 } 1112 1113 if ((logAdapter != null) && affectState) { 1114 this.logClassName = logAdapterClassName; 1116 this.logConstructor = constructor; 1117 1118 try { 1120 this.logMethod = logAdapterClass.getMethod("setLogFactory", 1121 logMethodSignature); 1122 logDiagnostic("Found method setLogFactory(LogFactory) in '" 1123 + logAdapterClassName + "'"); 1124 } catch (Throwable t) { 1125 this.logMethod = null; 1126 logDiagnostic( 1127 "[INFO] '" + logAdapterClassName 1128 + "' from classloader " + objectId(currentCL) 1129 + " does not declare optional method " 1130 + "setLogFactory(LogFactory)"); 1131 } 1132 1133 logDiagnostic( 1134 "Log adapter '" + logAdapterClassName 1135 + "' from classloader " + objectId(logAdapterClass.getClassLoader()) 1136 + " has been selected for use."); 1137 } 1138 1139 return logAdapter; 1140 } 1141 1142 1143 1161 private ClassLoader getBaseClassLoader() throws LogConfigurationException { 1162 ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); 1163 1164 if (useTCCL == false) { 1165 return thisClassLoader; 1166 } 1167 1168 ClassLoader contextClassLoader = getContextClassLoader(); 1169 1170 ClassLoader baseClassLoader = getLowestClassLoader( 1171 contextClassLoader, thisClassLoader); 1172 1173 if (baseClassLoader == null) { 1174 if (allowFlawedContext) { 1179 if (isDiagnosticsEnabled()) { 1180 logDiagnostic( 1181 "[WARNING] the context classloader is not part of a" 1182 + " parent-child relationship with the classloader that" 1183 + " loaded LogFactoryImpl."); 1184 } 1185 return contextClassLoader; 1189 } 1190 else { 1191 throw new LogConfigurationException( 1192 "Bad classloader hierarchy; LogFactoryImpl was loaded via" 1193 + " a classloader that is not related to the current context" 1194 + " classloader."); 1195 } 1196 } 1197 1198 if (baseClassLoader != contextClassLoader) { 1199 if (allowFlawedContext) { 1205 if (isDiagnosticsEnabled()) { 1206 logDiagnostic( 1207 "Warning: the context classloader is an ancestor of the" 1208 + " classloader that loaded LogFactoryImpl; it should be" 1209 + " the same or a descendant. The application using" 1210 + " commons-logging should ensure the context classloader" 1211 + " is used correctly."); 1212 } 1213 } else { 1214 throw new LogConfigurationException( 1215 "Bad classloader hierarchy; LogFactoryImpl was loaded via" 1216 + " a classloader that is not related to the current context" 1217 + " classloader."); 1218 } 1219 } 1220 1221 return baseClassLoader; 1222 } 1223 1224 1234 private ClassLoader getLowestClassLoader(ClassLoader c1, ClassLoader c2) { 1235 1237 if (c1 == null) 1238 return c2; 1239 1240 if (c2 == null) 1241 return c1; 1242 1243 ClassLoader current; 1244 1245 current = c1; 1247 while (current != null) { 1248 if (current == c2) 1249 return c1; 1250 current = current.getParent(); 1251 } 1252 1253 current = c2; 1255 while (current != null) { 1256 if (current == c1) 1257 return c2; 1258 current = current.getParent(); 1259 } 1260 1261 return null; 1262 } 1263 1264 1279 private void handleFlawedDiscovery(String logAdapterClassName, 1280 ClassLoader classLoader, 1281 Throwable discoveryFlaw) { 1282 1283 if (isDiagnosticsEnabled()) { 1284 logDiagnostic("Could not instantiate Log '" 1285 + logAdapterClassName + "' -- " 1286 + discoveryFlaw.getClass().getName() + ": " 1287 + discoveryFlaw.getLocalizedMessage()); 1288 } 1289 1290 if (!allowFlawedDiscovery) { 1291 throw new LogConfigurationException(discoveryFlaw); 1292 } 1293 } 1294 1295 1296 1322 private void handleFlawedHierarchy(ClassLoader badClassLoader, Class badClass) 1323 throws LogConfigurationException { 1324 1325 boolean implementsLog = false; 1326 String logInterfaceName = Log.class.getName(); 1327 Class interfaces[] = badClass.getInterfaces(); 1328 for (int i = 0; i < interfaces.length; i++) { 1329 if (logInterfaceName.equals(interfaces[i].getName())) { 1330 implementsLog = true; 1331 break; 1332 } 1333 } 1334 1335 if (implementsLog) { 1336 if (isDiagnosticsEnabled()) { 1339 try { 1340 ClassLoader logInterfaceClassLoader = getClassLoader(Log.class); 1341 logDiagnostic( 1342 "Class '" + badClass.getName() 1343 + "' was found in classloader " 1344 + objectId(badClassLoader) 1345 + ". It is bound to a Log interface which is not" 1346 + " the one loaded from classloader " 1347 + objectId(logInterfaceClassLoader)); 1348 } catch (Throwable t) { 1349 logDiagnostic( 1350 "Error while trying to output diagnostics about" 1351 + " bad class '" + badClass + "'"); 1352 } 1353 } 1354 1355 if (!allowFlawedHierarchy) { 1356 StringBuffer msg = new StringBuffer (); 1357 msg.append("Terminating logging for this context "); 1358 msg.append("due to bad log hierarchy. "); 1359 msg.append("You have more than one version of '"); 1360 msg.append(Log.class.getName()); 1361 msg.append("' visible."); 1362 if (isDiagnosticsEnabled()) { 1363 logDiagnostic(msg.toString()); 1364 } 1365 throw new LogConfigurationException(msg.toString()); 1366 } 1367 1368 if (isDiagnosticsEnabled()) { 1369 StringBuffer msg = new StringBuffer (); 1370 msg.append("Warning: bad log hierarchy. "); 1371 msg.append("You have more than one version of '"); 1372 msg.append(Log.class.getName()); 1373 msg.append("' visible."); 1374 logDiagnostic(msg.toString()); 1375 } 1376 } else { 1377 if (!allowFlawedDiscovery) { 1379 StringBuffer msg = new StringBuffer (); 1380 msg.append("Terminating logging for this context. "); 1381 msg.append("Log class '"); 1382 msg.append(badClass.getName()); 1383 msg.append("' does not implement the Log interface."); 1384 if (isDiagnosticsEnabled()) { 1385 logDiagnostic(msg.toString()); 1386 } 1387 1388 throw new LogConfigurationException(msg.toString()); 1389 } 1390 1391 if (isDiagnosticsEnabled()) { 1392 StringBuffer msg = new StringBuffer (); 1393 msg.append("[WARNING] Log class '"); 1394 msg.append(badClass.getName()); 1395 msg.append("' does not implement the Log interface."); 1396 logDiagnostic(msg.toString()); 1397 } 1398 } 1399 } 1400} 1401 | Popular Tags |