本文整理了Java中org.apache.commons.logging.LogFactory.setAttribute()
方法的一些代码示例,展示了LogFactory.setAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogFactory.setAttribute()
方法的具体详情如下:
包路径:org.apache.commons.logging.LogFactory
类名称:LogFactory
方法名:setAttribute
[英]Set the configuration attribute with the specified name. Calling this with a null
value is equivalent to calling removeAttribute(name)
.
[中]使用指定的名称设置配置属性。使用null
值调用此函数相当于调用removeAttribute(name)
。
代码示例来源:origin: commons-logging/commons-logging
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: robovm/robovm
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel
public void setAttribute(String name, Object value) {
synchronized (factoryLock) {
logFactory.setAttribute(name, value);
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: jboss.jbossts/jbossjts
/**
* 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);
}
}
代码示例来源:origin: timurstrekalov/saga
/**
* 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);
}
代码示例来源:origin: apache/fop
/**
* 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);
}
代码示例来源:origin: org.kitesdk/kite-tools
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);
}
}
代码示例来源:origin: openaudible/openaudible
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");
}
代码示例来源:origin: jboss.jbossts/jbossjts
/**
* 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;
}
代码示例来源:origin: ombre42/jrobotremoteserver
/**
* 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);
}
代码示例来源:origin: org.codehaus.openxma/xmabootrt
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",XmaBrtLogger.class.getName());
代码示例来源:origin: openaudible/openaudible
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);
}
}
代码示例来源:origin: com.paypal.selion/SeLion-Common
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.NoOpLog");
代码示例来源:origin: paypal/SeLion
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.NoOpLog");
代码示例来源:origin: OpenAS2/OpenAs2App
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"));
代码示例来源:origin: com.bugvm/bugvm-rt
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.logging
String name = (String) names.nextElement();
String value = props.getProperty(name);
factory.setAttribute(name, value);
代码示例来源:origin: approvals/ApprovalTests.Java
/***********************************************************************/
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);
}
}
/***********************************************************************/
内容来源于网络,如有侵权,请联系作者删除!