List of usage examples for org.apache.commons.logging LogFactory getLog
public static Log getLog(String name)
From source file:de.itsvs.cwtrpc.core.CwtRpcUtils.java
public static void preloadContextClasses(ServletContext servletContext) throws ApplicationContextException { final Log log = LogFactory.getLog(CwtRpcUtils.class); final String preloadedClasses; preloadedClasses = servletContext.getInitParameter(PRELOADED_CLASSES_INIT_PARAM_NAME); if (preloadedClasses != null) { final String[] classNames = preloadedClasses.split("\\s"); for (String className : classNames) { if (className.length() > 0) { if (log.isDebugEnabled()) { log.debug("Preloading class: " + className); }/*from w w w . ja va 2 s . c o m*/ try { CwtRpcUtils.class.getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { throw new ApplicationContextException("Could not load class '" + className + "'", e); } } } } }
From source file:am.ik.yalf.logger.impl.LoggerAdapterImpl.java
public Object getLogger(String name) { return LogFactory.getLog(name); }
From source file:com.lfv.lanzius.Main.java
public static void main(String[] args) { /*/*from www . j av a2 s .com*/ * debug levels: * error - Runtime errors or unexpected conditions. Expect these to be immediately visible on a status console. See also Internationalization. * warn - Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visible on a status console. See also Internationalization. * info - Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum. See also Internationalization. * debug - detailed information on the flow through the system. Expect these to be written to logs only. */ Log log = null; DOMConfigurator conf = new DOMConfigurator(); DOMConfigurator.configure("data/properties/loggingproperties.xml"); System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger"); try { if (args.length >= 1) { // Help if (args[0].startsWith("-h")) { printUsage(); return; } // List devices else if (args[0].startsWith("-l")) { AudioTest.listDevices(); return; } // Test seleted device else if (args[0].startsWith("-d")) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "warn"); try { String option = "all"; if (args.length >= 4) option = args[3]; if (option.equals("loop:direct")) AudioTest.testDevicesDirect(Integer.parseInt(args[1]), Integer.parseInt(args[2])); else { if (option.indexOf("debug") != -1) System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "debug"); AudioTest.testDevices(Integer.parseInt(args[1]), Integer.parseInt(args[2]), option, (args.length >= 5) ? args[4] : null, (args.length >= 6) ? args[5] : null, (args.length >= 7) ? args[6] : null); } } catch (Exception ex) { System.out.println(); System.out.println(Config.VERSION); System.out.println(); System.out.println("Usage:"); System.out.println( " yada.jar -d output_device input_device <option> <jitter_buffer> <output_buffer> <input_buffer>"); System.out.println(" option:"); System.out.println(" all(default)"); System.out.println(" clip"); System.out.println(" loop:jspeex"); System.out.println(" loop:null"); System.out.println(" loop:direct"); System.out.println(" loopdebug:jspeex"); System.out.println(" loopdebug:null"); System.out.println(" jitter_buffer:"); System.out.println(" size of jitter buffer in packets (1-20)"); System.out.println(" output_buffer:"); System.out.println(" size of output buffer in packets (1.0-4.0)"); System.out.println(" input_buffer:"); System.out.println(" size of input buffer in packets (1.0-4.0)"); System.out.println(); if (AudioTest.showStackTrace && !(ex instanceof ArrayIndexOutOfBoundsException)) ex.printStackTrace(); } //System.out.println("Exiting..."); return; } else if (args[0].startsWith("-m")) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "warn"); try { AudioTest.testMicrophoneLevel(Integer.parseInt(args[1])); } catch (Exception ex) { System.out.println(); System.out.println(Config.VERSION); System.out.println(); System.out.println("Usage:"); System.out.println(" yada.jar -m input_device"); System.out.println(); if (AudioTest.showStackTrace && !(ex instanceof ArrayIndexOutOfBoundsException)) ex.printStackTrace(); } return; } else if (args[0].startsWith("-s")) { Packet.randomSeed = 9182736455L ^ System.currentTimeMillis(); if (args.length > 2 && args[1].startsWith("-configuration")) { String configFilename = args[2]; if (args.length > 4 && args[3].startsWith("-exercise")) { String exerciseFilename = args[4]; LanziusServer.start(configFilename, exerciseFilename); } else { LanziusServer.start(configFilename); } } else { LanziusServer.start(); } return; } else if (args[0].startsWith("-f")) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty( "org.apache.commons.logging.simplelog.log.com.lfv.lanzius.application.FootSwitchController", "debug"); try { System.out.println("Starting footswitch controller test using device " + args[1]); try { boolean inverted = false; if (args.length >= 3) inverted = args[2].toLowerCase().startsWith("inv"); FootSwitchController c = new FootSwitchController(null, args[1], Constants.PERIOD_FTSW_CONNECTED, inverted); c.start(); Thread.sleep(30000); } catch (UnsatisfiedLinkError err) { if (args.length > 1) System.out.println("UnsatisfiedLinkError: " + err.getMessage()); else throw new ArrayIndexOutOfBoundsException(); System.out.println("Missing ftsw library (ftsw.dll or libftsw.so)"); if (!args[1].equalsIgnoreCase("ftdi")) System.out .println("Missing rxtxSerial library (rxtxSerial.dll or librxtxSerial.so)"); if (AudioTest.showStackTrace) err.printStackTrace(); } } catch (Exception ex) { if (ex instanceof NoSuchPortException) System.out.println("The serial port " + args[1] + " does not exist!"); else if (ex instanceof PortInUseException) System.out.println("The serial port " + args[1] + " is already in use!"); System.out.println(); System.out.println(Config.VERSION); System.out.println(); System.out.println("Usage:"); System.out.println(" yada.jar -f interface <invert>"); System.out.println(" interface:"); System.out.println(" ftdi"); System.out.println(" comport (COMx or /dev/ttyx)"); System.out.println(" invert:"); System.out.println(" true"); System.out.println(" false (default)"); System.out.println(); if (AudioTest.showStackTrace && !(ex instanceof ArrayIndexOutOfBoundsException)) ex.printStackTrace(); } return; } else if (args[0].startsWith("-c")) { Packet.randomSeed = 7233103157L ^ System.currentTimeMillis(); if (args.length >= 2) { try { int id = Integer.valueOf(args[1]); if (id <= 0) throw new NumberFormatException(); Controller c = Controller.getInstance(); if (args.length >= 3) { if (args[2].equalsIgnoreCase("test")) { c.setAutoTester(true); } } c.init(id); return; } catch (NumberFormatException ex) { printUsage(); } } else { Controller.getInstance().init(0); } } else printUsage(); } else printUsage(); } catch (Throwable t) { if (log == null) log = LogFactory.getLog(Main.class); log.error("Unhandled exception or error", t); } }
From source file:fr.aliasource.webmail.folder.ActionGetFolderSummaryAction.java
public ActionGetFolderSummaryAction() { logger = LogFactory.getLog(getClass()); }
From source file:com.acciente.induction.init.RedirectResolverInitializer.java
public static RedirectResolver getRedirectResolver(Config.RedirectResolver oRedirectResolverConfig, Config.RedirectMapping oRedirectMappingConfig, ModelPool oModelPool, ClassLoader oClassLoader, ServletConfig oServletConfig)// ww w . ja v a 2 s.c o m throws ClassNotFoundException, InvocationTargetException, ConstructorNotFoundException, ParameterProviderException, IllegalAccessException, InstantiationException, IOException { RedirectResolver oRedirectResolver; String sRedirectResolverClassName; Log oLog; oLog = LogFactory.getLog(RedirectResolverInitializer.class); sRedirectResolverClassName = oRedirectResolverConfig.getClassName(); if (Strings.isEmpty(sRedirectResolverClassName)) { oRedirectResolver = new ShortURLRedirectResolver(oRedirectMappingConfig, oClassLoader); } else { oLog.info("loading user-defined redirect resolver: " + sRedirectResolverClassName); Class oRedirectResolverClass = oClassLoader.loadClass(sRedirectResolverClassName); // attempt to find and call the single public constructor oRedirectResolver = (RedirectResolver) ObjectFactory.createObject(oRedirectResolverClass, new Object[] { oServletConfig, oRedirectResolverConfig, oRedirectMappingConfig, oClassLoader }, new InitializerParameterProvider(oModelPool, "redirect-resolver-init")); } return oRedirectResolver; }
From source file:com.microsoft.tfs.client.common.framework.command.TeamExplorerLogCommandStartedCallback.java
@Override public void onCommandStarted(final ICommand command) { Check.notNull(command, "command"); //$NON-NLS-1$ /*// w w w . ja v a2s . c om * Don't have a static Log for this class, because then the errors show * up as coming from this class, which is not correct. Instead, get the * logger for the class the errors originated from. Note that this is * not a particularly expensive operation - it looks up the classname in * a hashmap. This should be more than suitable for a command finished * error handler. */ final Log log = LogFactory.getLog(CommandHelpers.unwrapCommand(command).getClass()); final String logMessage = command.getLoggingDescription(); if (logMessage != null) { log.info(logMessage); } }
From source file:fr.aliasource.utils.IniFile.java
public IniFile(String path) { logger = LogFactory.getLog(getClass()); settings = new HashMap<String, String>(); File f = new File(path); if (f.exists()) { loadIniFile(f);/* www .ja va 2 s . c om*/ } else { logger.warn(path + " does not exist."); } }
From source file:net.sf.nmedit.jtheme.JTContext.java
protected static Log getLogger() { if (_log == null) _log = LogFactory.getLog(JTContext.class); return _log; }
From source file:fr.aliasource.webmail.attachments.AllocateIdAction.java
public AllocateIdAction() { logger = LogFactory.getLog(getClass()); if (logger.isDebugEnabled()) { logger.debug("AllocateIdAction created."); } }
From source file:com.tnsoft.util.logging.AbstractLog.java
public AbstractLog(Class<?> clazz) { log = LogFactory.getLog(clazz); }