[lsc-changes] r481 - in lsc/trunk/src: main/java/org/lsc main/java/org/lsc/beans main/java/org/lsc/jndi main/java/org/lsc/service main/java/org/lsc/utils test/java/org/lsc/persistence test/java/org/lsc/utils test/java/org/lsc/utils/output

rschermesser at lsc-project.org rschermesser at lsc-project.org
Sun Nov 29 18:17:47 CET 2009


Author: rschermesser
Date: 2009-11-29 18:17:47 +0100 (Sun, 29 Nov 2009)
New Revision: 481

Modified:
   lsc/trunk/src/main/java/org/lsc/Launcher.java
   lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java
   lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
   lsc/trunk/src/main/java/org/lsc/service/JdbcSrcServiceObjectGenerator.java
   lsc/trunk/src/main/java/org/lsc/utils/I18n.java
   lsc/trunk/src/test/java/org/lsc/persistence/DaoConfigTest.java
   lsc/trunk/src/test/java/org/lsc/utils/LdapServer.java
   lsc/trunk/src/test/java/org/lsc/utils/output/CsvLayoutTest.java
   lsc/trunk/src/test/java/org/lsc/utils/output/LdifLayoutTest.java
Log:
Fixes #154, Change logger.error(stacktrace) to logger.debug(stacktrace)

Modified: lsc/trunk/src/main/java/org/lsc/Launcher.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/Launcher.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/main/java/org/lsc/Launcher.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -122,7 +122,8 @@
 			// do the work!
 			sync.launch(syncType, cleanType);
 		} catch (Exception e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		}
 	}
 

Modified: lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -395,9 +395,11 @@
 				return null;
 			}
 		} catch (InstantiationException ie) {
-			LOGGER.error(ie.toString(), ie);
+			LOGGER.error(ie.toString());
+			LOGGER.debug(ie.toString(), ie);
 		} catch (IllegalAccessException iae) {
-			LOGGER.error(iae.toString(), iae);
+			LOGGER.error(iae.toString());
+			LOGGER.debug(iae.toString(), iae);
 		}
 
 		return null;

Modified: lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -179,7 +179,8 @@
 		try {
 			namingContext = new LDAPUrl((String) ctx.getEnvironment().get(Context.PROVIDER_URL));
 		} catch (MalformedURLException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 			throw new NamingException(e.getMessage());
 		}
 
@@ -378,7 +379,8 @@
 		try {
 			return (readEntry(dn, filter, true) != null);
 		} catch (NamingException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		}
 		return false;
 	}
@@ -493,9 +495,10 @@
 			while (ne.hasMore()) {
 				l.add(((SearchResult) ne.next()).getName() + completedBaseDn);
 			}
-		} catch (NamingException nex) {
-			LOGGER.error(nex.toString(), nex);
-			throw nex;
+		} catch (NamingException e) {
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
+			throw e;
 		}
 		return l;
 	}

Modified: lsc/trunk/src/main/java/org/lsc/service/JdbcSrcServiceObjectGenerator.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/service/JdbcSrcServiceObjectGenerator.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/main/java/org/lsc/service/JdbcSrcServiceObjectGenerator.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -413,9 +413,10 @@
 												fileName);
             }
         } catch (FileNotFoundException fnfe) {
-            LOGGER.error(fnfe.toString(), fnfe);
+					LOGGER.error(fnfe.toString());
+					LOGGER.debug(fnfe.toString(), fnfe);
         } catch (IOException e) {
-            LOGGER.error("{} ({})", e, fileName);
+					LOGGER.error("{} ({})", e, fileName);
         }
 
         return false;
@@ -442,6 +443,6 @@
      * @return A java generic file name.
      */
     public final String getFileName() {
-	return getStandardFileName();
+			return getStandardFileName();
     }
 }

Modified: lsc/trunk/src/main/java/org/lsc/utils/I18n.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/utils/I18n.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/main/java/org/lsc/utils/I18n.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -69,7 +69,7 @@
 public class I18n {
 
 	/** The logger */
-	private static Logger logger = LoggerFactory.getLogger(I18n.class);
+	private static Logger LOGGER = LoggerFactory.getLogger(I18n.class);
 	/** The messages in the current language */
 	private ResourceBundle messages;
 	/** the instance */
@@ -127,7 +127,7 @@
 				lang = lang.substring(0, lang.indexOf('.'));
 			}
 		} else {
-			logger.info("No environemental LANG variable found. Defaulting to en_US.");
+			LOGGER.info("No environemental LANG variable found. Defaulting to en_US.");
 			lang = "en_US";
 		}
 		
@@ -142,11 +142,11 @@
 			try {
 				setLocaleAndLoadMessages(currentLocale);
 			} catch (IOException e) {
-				logger.error("Unable to open the locale message file for {} ! Exiting...", currentLocale);
+				LOGGER.error("Unable to open the locale message file for {} ! Exiting...", currentLocale);
 				throw new RuntimeException("Unable to find locale : " + lang + " ! Exiting ...");
 			}
 		} else {
-			logger.error("Unable to find locale : {} ! Exiting ...", lang);
+			LOGGER.error("Unable to find locale : {} ! Exiting ...", lang);
 			throw new RuntimeException("Unable to find locale : " + lang + " ! Exiting ...");
 		}
 	}
@@ -161,16 +161,17 @@
 
 	private void setLocaleAndLoadMessages(Locale locale) throws IOException {
 		currentLocale = locale;
-		logger.debug("Setting locale to {}", locale);
+		LOGGER.debug("Setting locale to {}", locale);
 		try {
 			messages = ResourceBundle.getBundle(
 							localeDirectory + sep + PROJECT_NAME,
 							currentLocale,
 							new I18nCustomClassLoader());
-		} catch (MissingResourceException mre) {
-			logger.error(mre.toString(), mre);
-			logger.debug(System.getenv("CLASSPATH"));
-			throw mre;
+		} catch (MissingResourceException e) {
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
+			LOGGER.debug(System.getenv("CLASSPATH"));
+			throw e;
 		}
 	}
 
@@ -182,7 +183,7 @@
 		try {
 			return messages.getString(code);
 		} catch (MissingResourceException mre) {
-			logger.error("I18n layer: unknown code {}", code);
+			LOGGER.error("I18n layer: unknown code {}", code);
 		}
 		return null;
 	}
@@ -211,7 +212,8 @@
 					try {
 						message = StringUtils.replace(message, "{" + i + "}", objs[i].toString());
 					} catch (IllegalArgumentException e) {
-						logger.error(e.toString(), e);
+						LOGGER.error(e.toString());
+						LOGGER.debug(e.toString(), e);
 					}
 				}
 			}

Modified: lsc/trunk/src/test/java/org/lsc/persistence/DaoConfigTest.java
===================================================================
--- lsc/trunk/src/test/java/org/lsc/persistence/DaoConfigTest.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/test/java/org/lsc/persistence/DaoConfigTest.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -103,7 +103,8 @@
 				LOGGER.debug("Table has {} rows.", rs.getInt(1));
 			}
 		} catch (SQLException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		}
 		assertNotNull(rs);
 	}
@@ -124,7 +125,8 @@
 		try {
 			con.close();
 		} catch (SQLException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		}
 	}
 }

Modified: lsc/trunk/src/test/java/org/lsc/utils/LdapServer.java
===================================================================
--- lsc/trunk/src/test/java/org/lsc/utils/LdapServer.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/test/java/org/lsc/utils/LdapServer.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -121,19 +121,26 @@
 		try {
 			retCode = usage(args);
 		} catch (InitializationException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (DirectoryException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (CanceledOperationException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (LDIFException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (IOException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (URISyntaxException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		} catch (ConfigException e) {
-			LOGGER.error(e.toString(), e);
+			LOGGER.error(e.toString());
+			LOGGER.debug(e.toString(), e);
 		}
 		if (retCode != 0) {
 			System.exit(retCode);
@@ -175,7 +182,13 @@
 				return 1;
 			}
 		} catch (ParseException e) {
-			LOGGER.error("Unable to parse options : {} ({})", args, e);
+			if(LOGGER.isErrorEnabled()) {
+				StringBuffer sbf = new StringBuffer();
+				for(String arg: args) {
+					sbf.append(arg).append(" ");
+				}
+				LOGGER.error("Unable to parse options : {}({})", sbf.toString(), e);
+			}
 			LOGGER.debug(e.toString(), e);
 			return 1;
 		}

Modified: lsc/trunk/src/test/java/org/lsc/utils/output/CsvLayoutTest.java
===================================================================
--- lsc/trunk/src/test/java/org/lsc/utils/output/CsvLayoutTest.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/test/java/org/lsc/utils/output/CsvLayoutTest.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -70,11 +70,11 @@
 public class CsvLayoutTest extends TestCase {
 
 	private LoggerContext lc = new LoggerContext();
-	private Logger logger = lc.getLogger(CsvLayout.class);
+	private Logger LOGGER = lc.getLogger(CsvLayout.class);
 
 	private ILoggingEvent makeLoggingEvent(String message, Object object) {
 		return new LoggingEvent("org.lsc",
-						logger, Level.INFO, message,
+						LOGGER, Level.INFO, message,
 						new Exception(), new Object[]{object});
 	}
 

Modified: lsc/trunk/src/test/java/org/lsc/utils/output/LdifLayoutTest.java
===================================================================
--- lsc/trunk/src/test/java/org/lsc/utils/output/LdifLayoutTest.java	2009-11-29 17:14:07 UTC (rev 480)
+++ lsc/trunk/src/test/java/org/lsc/utils/output/LdifLayoutTest.java	2009-11-29 17:17:47 UTC (rev 481)
@@ -73,11 +73,11 @@
 public class LdifLayoutTest extends TestCase {
 
 	private LoggerContext lc = new LoggerContext();
-	private Logger logger = lc.getLogger(LdifLayout.class);
+	private Logger LOGGER = lc.getLogger(LdifLayout.class);
 
 	private ILoggingEvent makeLoggingEvent(String message, Object object) {
 		return new LoggingEvent("org.lsc",
-						logger, Level.INFO, message,
+						LOGGER, Level.INFO, message,
 						new Exception(), new Object[]{object});
 	}
 



More information about the lsc-changes mailing list