String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
public void setAttribute(String name, Object value) { synchronized (factoryLock) { logFactory.setAttribute(name, value); } } }
String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
/** * Restore the factory configuration to the provided value. */ private void resetFactory(Object value) { org.apache.commons.logging.LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", value); } }
/** * Make HtmlUnit's logger shut up for good. */ public static void silenceHtmlUnitLogging() { LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF); java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF); }
/** * Sets the logging level. * @param level the logging level ("debug", "info", "error" etc., see Jakarta Commons Logging) */ protected static void setLogLevel(String level) { // Set the evel for future loggers. LogFactory.getFactory().setAttribute("level", level); }
public static void main(String[] args) throws Exception { // reconfigure logging with the kite CLI configuration PropertyConfigurator.configure( Main.class.getResource("/kite-cli-logging.properties")); Logger console = LoggerFactory.getLogger(Main.class); // use Log4j for any libraries using commons-logging LogFactory.getFactory().setAttribute( "org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger"); int rc = ToolRunner.run(new HiveConf(), new Main(console), args); System.exit(rc); } }
public void init() throws IOException { audible.init(); audible.initConverter(); java.util.logging.Logger.getLogger("audiblescrape").setLevel(Level.INFO); LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); }
/** * Install our custom logger by setting the factory attribute */ private Object configureFactory() { Object oldValue = org.apache.commons.logging.LogFactory.getFactory().getAttribute("org.apache.commons.logging.Log"); org.apache.commons.logging.LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", logImpl); return oldValue; }
/** * Configures logging systems used by <tt>RemoteServer</tt> and its * dependencies. Specifically, * <ul> * <li>Configure Log4J to log to the console</li> * <li>Set Log4J's log level to INFO</li> * <li>Redirect the Jetty's logging to Log4J</li> * <li>Set Jakarta Commons Logging to log to Log4J</li> * </ul> * This is convenient if you do not want to configure the logging yourself. * This will only affect future instances of * {@link org.eclipse.jetty.util.log.Logger} and * {@link org.apache.commons.logging.Log}, so this should be called as early * as possible. */ public static void configureLogging() { Logger root = Logger.getRootLogger(); root.removeAllAppenders(); BasicConfigurator.configure(); root.setLevel(Level.INFO); org.eclipse.jetty.util.log.Log.setLog(new Jetty2Log4J()); LogFactory.releaseAll(); LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger"); log = LogFactory.getLog(RemoteServer.class); }
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",XmaBrtLogger.class.getName());
public void init() throws IOException { assert (Audible.instance == null); // for now; Directories.assertInitialized(); try { audible.init(); audible.initConverter(); // Listen for events about jobs: BookQueueListener queueListener = new BookQueueListener(); // downloading aax files audible.downloadQueue.addListener(queueListener); // converting aax to mp3. audible.convertQueue.addListener(queueListener); ConnectionNotifier.instance.addListener(this); LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); } catch (Throwable th) { th.printStackTrace(); showError(th, "starting application"); System.exit(1); } }
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("org.apache.commons.logging.Log", "org.openas2.logging.Log"); LogFactory.getFactory().setAttribute("level", "TRACE"); System.out.println("Current working directory: " + System.getProperty("user.dir") + System.getProperty("line.separator")); System.out.println("Logging prop: " + System.getProperty("org.apache.commons.logging.Log") + System.getProperty("line.separator"));
String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value);
/***********************************************************************/ public synchronized Connection makeConnection(String database, DatabaseConfiguration originalConfiguration) { int port = counter++; DatabaseConfiguration config = new DatabaseConfiguration(originalConfiguration.getDataSourceName(), originalConfiguration.getDriver(), originalConfiguration.getProtocol(), "localhost", "" + port, database, originalConfiguration.getUserName(), originalConfiguration.getPassword(), originalConfiguration.getType()); try { LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); SshClient ssh = new SshClient(); ssh.setSocketTimeout(60000); ssh.connect(originalConfiguration.getServer(), new IgnoreHostKeyVerification()); PasswordAuthenticationClient pwd = new PasswordAuthenticationClient(); pwd.setUsername(originalConfiguration.getUserName()); pwd.setPassword(originalConfiguration.getPassword()); ssh.authenticate(pwd); ForwardingClient client = ssh.getForwardingClient(); client.addLocalForwarding(config.getProtocol(), "0.0.0.0", config.getPort(), "localhost", originalConfiguration.getPort()); client.startLocalForwarding(config.getProtocol()); return new SshConnection(ssh, config.makeConnection()); } catch (IOException ie) { throw ObjectUtils.throwAsError(ie); } } /***********************************************************************/