@Override
public void agentStarted(@NotNull BuildAgent agent) {
checkReady();
try {
startSeeder();
} catch (IOException e) {
LOG.warnAndDebugDetails("error start seeder on agent started", e);
}
LogManager.getLogger("com.turn.ttorrent", new LoggerFactory() {
@Override
public org.apache.log4j.Logger makeNewLoggerInstance(String s) {
return org.apache.log4j.Logger.getLogger(Loggers.AGENT_CATEGORY);
}
});
}
java类org.apache.log4j.spi.LoggerFactory的实例源码
AgentTorrentsManager.java 文件源码
项目:teamcity-torrent-plugin
阅读 19
收藏 0
点赞 0
评论 0
Lonline.java 文件源码
项目:lonline_for_java
阅读 20
收藏 0
点赞 0
评论 0
/**
* Returns a Lonline logger according className
*
* @param className className
* @return Lonline logger
*/
static public Lonline getLogger(String className) {
return (Lonline) LogManager.getLogger(className, new LoggerFactory() {
@Override
public Logger makeNewLoggerInstance(String name) {
return new Lonline(name);
}
});
}
Lonline.java 文件源码
项目:lonline_for_java
阅读 22
收藏 0
点赞 0
评论 0
/**
* Returns a Lonline logger according clazz object
*
* @param clazz clazz object
* @return Lonline logger
*/
static public Lonline getLogger(Class clazz) {
return (Lonline) LogManager.getLogger(clazz.getName(), new LoggerFactory() {
@Override
public Logger makeNewLoggerInstance(String name) {
return new Lonline(name);
}
});
}
PropertyConfigurator.java 文件源码
项目:cacheonix-core
阅读 29
收藏 0
点赞 0
评论 0
/**
Check the provided <code>Properties</code> object for a
{@link org.apache.log4j.spi.LoggerFactory LoggerFactory}
entry specified by {@link #LOGGER_FACTORY_KEY}. If such an entry
exists, an attempt is made to create an instance using the default
constructor. This instance is used for subsequent Category creations
within this configurator.
@see #parseCatsAndRenderers
*/
protected void configureLoggerFactory(Properties props) {
String factoryClassName = OptionConverter.findAndSubst(LOGGER_FACTORY_KEY,
props);
if(factoryClassName != null) {
LogLog.debug("Setting category factory to ["+factoryClassName+"].");
loggerFactory = (LoggerFactory)
OptionConverter.instantiateByClassName(factoryClassName,
LoggerFactory.class,
loggerFactory);
PropertySetter.setProperties(loggerFactory, props, FACTORY_PREFIX + ".");
}
}
LogManager.java 文件源码
项目:cacheonix-core
阅读 53
收藏 0
点赞 0
评论 0
/**
Retrieve the appropriate {@link Logger} instance.
*/
public
static
Logger getLogger(final String name, final LoggerFactory factory) {
// Delegate the actual manufacturing of the logger to the logger repository.
return getLoggerRepository().getLogger(name, factory);
}
Hierarchy.java 文件源码
项目:cacheonix-core
阅读 21
收藏 0
点赞 0
评论 0
/**
Return a new logger instance named as the first parameter using
<code>factory</code>.
<p>If a logger of that name already exists, then it will be
returned. Otherwise, a new logger will be instantiated by the
<code>factory</code> parameter and linked with its existing
ancestors as well as children.
@param name The name of the logger to retrieve.
@param factory The factory that will make the new logger instance.
*/
public
Logger getLogger(String name, LoggerFactory factory) {
//System.out.println("getInstance("+name+") called.");
CategoryKey key = new CategoryKey(name);
// Synchronize to prevent write conflicts. Read conflicts (in
// getChainedLevel method) are possible only if variable
// assignments are non-atomic.
Logger logger;
synchronized(ht) {
Object o = ht.get(key);
if(o == null) {
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateParents(logger);
return logger;
} else if(o instanceof Logger) {
return (Logger) o;
} else if (o instanceof ProvisionNode) {
//System.out.println("("+name+") ht.get(this) returned ProvisionNode");
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateChildren((ProvisionNode) o, logger);
updateParents(logger);
return logger;
}
else {
// It should be impossible to arrive here
return null; // but let's keep the compiler happy.
}
}
}
DOMConfigurator.java 文件源码
项目:cacheonix-core
阅读 25
收藏 0
点赞 0
评论 0
/**
Used internally to parse the category factory element.
*/
protected
void parseCategoryFactory(Element factoryElement) {
String className = subst(factoryElement.getAttribute(CLASS_ATTR));
if(EMPTY_STR.equals(className)) {
LogLog.error("Category Factory tag " + CLASS_ATTR + " attribute not found.");
LogLog.debug("No Category Factory configured.");
}
else {
LogLog.debug("Desired category factory: ["+className+']');
Object factory = OptionConverter.instantiateByClassName(className,
LoggerFactory.class,
null);
if (factory instanceof LoggerFactory) {
catFactory = (LoggerFactory) factory;
} else {
LogLog.error("Category Factory class " + className + " does not implement org.apache.log4j.LoggerFactory");
}
PropertySetter propSetter = new PropertySetter(factory);
Element currentElement = null;
Node currentNode = null;
NodeList children = factoryElement.getChildNodes();
final int length = children.getLength();
for (int loop=0; loop < length; loop++) {
currentNode = children.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
currentElement = (Element)currentNode;
if (currentElement.getTagName().equals(PARAM_TAG)) {
setParameter(currentElement, propSetter);
} else {
quietParseUnrecognizedElement(factory, currentElement, props);
}
}
}
}
}
Log4jLoggerFactory.java 文件源码
项目:bartleby
阅读 22
收藏 0
点赞 0
评论 0
public static Logger getLogger(String name, LoggerFactory loggerFactory) {
org.apache.log4j.Logger instance = log4jLoggers.get(name);
if (instance != null) {
return instance;
} else {
Logger newInstance = loggerFactory.makeNewLoggerInstance(name);
Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
return oldInstance == null ? newInstance : oldInstance;
}
}
Log4jSyslogBackLogHandler.java 文件源码
项目:syslog4j
阅读 23
收藏 0
点赞 0
评论 0
public Log4jSyslogBackLogHandler(String loggerName, LoggerFactory loggerFactory) {
if (loggerName == null) {
throw new SyslogRuntimeException("loggerName cannot be null");
}
if (loggerFactory == null) {
throw new SyslogRuntimeException("loggerFactory cannot be null");
}
this.logger = Logger.getLogger(loggerName,loggerFactory);
initialize();
}
Log4jSyslogBackLogHandler.java 文件源码
项目:syslog4j
阅读 19
收藏 0
点赞 0
评论 0
public Log4jSyslogBackLogHandler(String loggerName, LoggerFactory loggerFactory, boolean appendReason) {
if (loggerName == null) {
throw new SyslogRuntimeException("loggerName cannot be null");
}
if (loggerFactory == null) {
throw new SyslogRuntimeException("loggerFactory cannot be null");
}
this.logger = Logger.getLogger(loggerName,loggerFactory);
this.appendReason = appendReason;
initialize();
}
PropertyConfigurator.java 文件源码
项目:daq-eclipse
阅读 40
收藏 0
点赞 0
评论 0
/**
Check the provided <code>Properties</code> object for a
{@link org.apache.log4j.spi.LoggerFactory LoggerFactory}
entry specified by {@link #LOGGER_FACTORY_KEY}. If such an entry
exists, an attempt is made to create an instance using the default
constructor. This instance is used for subsequent Category creations
within this configurator.
@see #parseCatsAndRenderers
*/
protected void configureLoggerFactory(Properties props) {
String factoryClassName = OptionConverter.findAndSubst(LOGGER_FACTORY_KEY,
props);
if(factoryClassName != null) {
LogLog.debug("Setting category factory to ["+factoryClassName+"].");
loggerFactory = (LoggerFactory)
OptionConverter.instantiateByClassName(factoryClassName,
LoggerFactory.class,
loggerFactory);
PropertySetter.setProperties(loggerFactory, props, FACTORY_PREFIX + ".");
}
}
LogManager.java 文件源码
项目:daq-eclipse
阅读 31
收藏 0
点赞 0
评论 0
/**
Retrieve the appropriate {@link Logger} instance.
*/
public
static
Logger getLogger(final String name, final LoggerFactory factory) {
// Delegate the actual manufacturing of the logger to the logger repository.
return getLoggerRepository().getLogger(name, factory);
}
Hierarchy.java 文件源码
项目:daq-eclipse
阅读 20
收藏 0
点赞 0
评论 0
/**
Return a new logger instance named as the first parameter using
<code>factory</code>.
<p>If a logger of that name already exists, then it will be
returned. Otherwise, a new logger will be instantiated by the
<code>factory</code> parameter and linked with its existing
ancestors as well as children.
@param name The name of the logger to retrieve.
@param factory The factory that will make the new logger instance.
*/
public
Logger getLogger(String name, LoggerFactory factory) {
//System.out.println("getInstance("+name+") called.");
CategoryKey key = new CategoryKey(name);
// Synchronize to prevent write conflicts. Read conflicts (in
// getChainedLevel method) are possible only if variable
// assignments are non-atomic.
Logger logger;
synchronized(ht) {
Object o = ht.get(key);
if(o == null) {
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateParents(logger);
return logger;
} else if(o instanceof Logger) {
return (Logger) o;
} else if (o instanceof ProvisionNode) {
//System.out.println("("+name+") ht.get(this) returned ProvisionNode");
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateChildren((ProvisionNode) o, logger);
updateParents(logger);
return logger;
}
else {
// It should be impossible to arrive here
return null; // but let's keep the compiler happy.
}
}
}
DOMConfigurator.java 文件源码
项目:daq-eclipse
阅读 25
收藏 0
点赞 0
评论 0
/**
Used internally to parse the category factory element.
*/
protected
void parseCategoryFactory(Element factoryElement) {
String className = subst(factoryElement.getAttribute(CLASS_ATTR));
if(EMPTY_STR.equals(className)) {
LogLog.error("Category Factory tag " + CLASS_ATTR + " attribute not found.");
LogLog.debug("No Category Factory configured.");
}
else {
LogLog.debug("Desired category factory: ["+className+']');
Object factory = OptionConverter.instantiateByClassName(className,
LoggerFactory.class,
null);
if (factory instanceof LoggerFactory) {
catFactory = (LoggerFactory) factory;
} else {
LogLog.error("Category Factory class " + className + " does not implement org.apache.log4j.LoggerFactory");
}
PropertySetter propSetter = new PropertySetter(factory);
Element currentElement = null;
Node currentNode = null;
NodeList children = factoryElement.getChildNodes();
final int length = children.getLength();
for (int loop=0; loop < length; loop++) {
currentNode = children.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
currentElement = (Element)currentNode;
if (currentElement.getTagName().equals(PARAM_TAG)) {
setParameter(currentElement, propSetter);
} else {
quietParseUnrecognizedElement(factory, currentElement, props);
}
}
}
}
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 19
收藏 0
点赞 0
评论 0
public ThreadLocalAwareLoggerRepository(Logger originalRoot, LoggerRepository parentRepository, LoggerFactory loggerFactory) {
super(originalRoot);
if (loggerFactory == null) {
throw new IllegalArgumentException("loggerFactory must not be null");
}
loggerFactory_ = loggerFactory;
parentLoggerRepository_ = parentRepository;
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 24
收藏 0
点赞 0
评论 0
@Override
public Logger getLogger(String name, @SuppressWarnings("unused") LoggerFactory factory) {
Logger existingLogger = parentLoggerRepository_.exists(name);
if (existingLogger != null) {
// Returning the original logger here - note that this will prevent certain loggers from being
// taken under ThreadLocalAwareLogger's control - hence any logger created before
// ThreadLocalLogLevelManager.install() will not be redirected!
return existingLogger;
} else {
return super.getLogger(name, loggerFactory_);
}
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 19
收藏 0
点赞 0
评论 0
/**
* Installs the ThreadLogManager in this system.
* <p>
* Note that this can fail if some other framework has done a call to LogManager.setRepositorySelector with a guard already.
*
* @param logMessageModifier
* optional implementation of LogMessageModifier which allows messages to be modified should they be affected by a threadlocal loglevel overwrite. This
* allows for example for messages to be prepended with a token so that they can be easier found in the log
*/
void install(final LogMessageModifier logMessageModifier) {
try {
final LoggerFactory loggerFactory = new LoggerFactory() {
@SuppressWarnings("synthetic-access")
@Override
public Logger makeNewLoggerInstance(String name) {
return new ThreadLocalAwareLogger(name, threadLocalLogLevel_, logMessageModifier);
}
};
final Logger originalRootLogger = LogManager.getRootLogger();
final LoggerRepository parentRepository = originalRootLogger.getLoggerRepository();
final LoggerRepository repository = new ThreadLocalAwareLoggerRepository(originalRootLogger, parentRepository, loggerFactory);
LogManager.setRepositorySelector(new RepositorySelector() {
@Override
public LoggerRepository getLoggerRepository() {
return repository;
}
}, guard);
} catch (IllegalArgumentException re) {
// thrown by LogManager.setRepositorySelector
log.error("Could not install ThreadLocalLogLevelManager", re);
}
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 23
收藏 0
点赞 0
评论 0
public ThreadLocalAwareLoggerRepository(Logger originalRoot, LoggerRepository parentRepository, LoggerFactory loggerFactory) {
super(originalRoot);
if (loggerFactory == null) {
throw new IllegalArgumentException("loggerFactory must not be null");
}
loggerFactory_ = loggerFactory;
parentLoggerRepository_ = parentRepository;
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 23
收藏 0
点赞 0
评论 0
@Override
public Logger getLogger(String name, LoggerFactory factory) {
Logger existingLogger = parentLoggerRepository_.exists(name);
if (existingLogger != null) {
// Returning the original logger here - note that this will prevent certain loggers from being
// taken under ThreadLocalAwareLogger's control - hence any logger created before
// ThreadLocalLogLevelManager.install() will not be redirected!
return existingLogger;
} else {
return super.getLogger(name, loggerFactory_);
}
}
ThreadLocalLogLevelManager.java 文件源码
项目:olat
阅读 21
收藏 0
点赞 0
评论 0
/**
* Installs the ThreadLogManager in this system.
* <p>
* Note that this can fail if some other framework has done a call to LogManager.setRepositorySelector with a guard already.
*
* @param logMessageModifier
* optional implementation of LogMessageModifier which allows messages to be modified should they be affected by a threadlocal loglevel overwrite. This
* allows for example for messages to be prepended with a token so that they can be easier found in the log
*/
void install(final LogMessageModifier logMessageModifier) {
try {
final LoggerFactory loggerFactory = new LoggerFactory() {
@SuppressWarnings("synthetic-access")
@Override
public Logger makeNewLoggerInstance(String name) {
return new ThreadLocalAwareLogger(name, threadLocalLogLevel_, logMessageModifier);
}
};
final Logger originalRootLogger = LogManager.getRootLogger();
final LoggerRepository parentRepository = originalRootLogger.getLoggerRepository();
final LoggerRepository repository = new ThreadLocalAwareLoggerRepository(originalRootLogger, parentRepository, loggerFactory);
LogManager.setRepositorySelector(new RepositorySelector() {
@Override
public LoggerRepository getLoggerRepository() {
return repository;
}
}, guard);
} catch (IllegalArgumentException re) {
// thrown by LogManager.setRepositorySelector
log.error("Could not install ThreadLocalLogLevelManager", re);
}
}
PropertyConfigurator.java 文件源码
项目:nabs
阅读 28
收藏 0
点赞 0
评论 0
/**
Check the provided <code>Properties</code> object for a
{@link org.apache.log4j.spi.LoggerFactory LoggerFactory}
entry specified by {@link #LOGGER_FACTORY_KEY}. If such an entry
exists, an attempt is made to create an instance using the default
constructor. This instance is used for subsequent Category creations
within this configurator.
@see #parseCatsAndRenderers
*/
protected void configureLoggerFactory(Properties props) {
String factoryClassName = OptionConverter.findAndSubst(LOGGER_FACTORY_KEY,
props);
if(factoryClassName != null) {
LogLog.debug("Setting category factory to ["+factoryClassName+"].");
loggerFactory = (LoggerFactory)
OptionConverter.instantiateByClassName(factoryClassName,
LoggerFactory.class,
loggerFactory);
PropertySetter.setProperties(loggerFactory, props, FACTORY_PREFIX + ".");
}
}
LogManager.java 文件源码
项目:nabs
阅读 29
收藏 0
点赞 0
评论 0
/**
Retrieve the appropriate {@link Logger} instance.
*/
public
static
Logger getLogger(String name, LoggerFactory factory) {
// Delegate the actual manufacturing of the logger to the logger repository.
return repositorySelector.getLoggerRepository().getLogger(name, factory);
}
Hierarchy.java 文件源码
项目:nabs
阅读 19
收藏 0
点赞 0
评论 0
/**
Return a new logger instance named as the first parameter using
<code>factory</code>.
<p>If a logger of that name already exists, then it will be
returned. Otherwise, a new logger will be instantiated by the
<code>factory</code> parameter and linked with its existing
ancestors as well as children.
@param name The name of the logger to retrieve.
@param factory The factory that will make the new logger instance.
*/
public
Logger getLogger(String name, LoggerFactory factory) {
//System.out.println("getInstance("+name+") called.");
CategoryKey key = new CategoryKey(name);
// Synchronize to prevent write conflicts. Read conflicts (in
// getChainedLevel method) are possible only if variable
// assignments are non-atomic.
Logger logger;
synchronized(ht) {
Object o = ht.get(key);
if(o == null) {
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateParents(logger);
return logger;
} else if(o instanceof Logger) {
return (Logger) o;
} else if (o instanceof ProvisionNode) {
//System.out.println("("+name+") ht.get(this) returned ProvisionNode");
logger = factory.makeNewLoggerInstance(name);
logger.setHierarchy(this);
ht.put(key, logger);
updateChildren((ProvisionNode) o, logger);
updateParents(logger);
return logger;
}
else {
// It should be impossible to arrive here
return null; // but let's keep the compiler happy.
}
}
}
Log4jLoggerFactory.java 文件源码
项目:jretty-log
阅读 32
收藏 0
点赞 0
评论 0
public static Logger getLogger(String name, LoggerFactory loggerFactory) {
org.apache.log4j.Logger instance = log4jLoggers.get(name);
if (instance != null) {
return instance;
} else {
Logger newInstance = loggerFactory.makeNewLoggerInstance(name);
Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
return oldInstance == null ? newInstance : oldInstance;
}
}
HaxeDebugLogger.java 文件源码
项目:intellij-haxe
阅读 21
收藏 0
点赞 0
评论 0
public static HaxeDebugLogger getLogger(String name, LoggerFactory factory) {
Logger logger = manager.getHierarchy().getLogger(name, factory);
assert(logger instanceof HaxeDebugLogger);
if (manager.getLogConfiguration().contains(name)) {
logger.setLevel(manager.getLogConfiguration().getLevel(name));
} else {
manager.getLogConfiguration().addConfiguration(name, manager.getDefaultLevel());
logger.setLevel(manager.getDefaultLevel());
}
logger.addAppender(manager.getDefaultAppender());
return (HaxeDebugLogger)logger;
}
Category.java 文件源码
项目:log4j2
阅读 23
收藏 0
点赞 0
评论 0
static Category getInstance(final LoggerContext context, final String name, final LoggerFactory factory) {
final ConcurrentMap<String, Logger> loggers = getLoggersMap(context);
Logger logger = loggers.get(name);
if (logger != null) {
return logger;
}
logger = factory.makeNewLoggerInstance(context, name);
final Logger prev = loggers.putIfAbsent(name, logger);
return prev == null ? logger : prev;
}
Log4jSyslogBackLogHandler.java 文件源码
项目:syslog4j-graylog2
阅读 17
收藏 0
点赞 0
评论 0
public Log4jSyslogBackLogHandler(String loggerName, LoggerFactory loggerFactory) {
if (loggerName == null) {
throw new SyslogRuntimeException("loggerName cannot be null");
}
if (loggerFactory == null) {
throw new SyslogRuntimeException("loggerFactory cannot be null");
}
this.logger = Logger.getLogger(loggerName, loggerFactory);
initialize();
}
Log4jSyslogBackLogHandler.java 文件源码
项目:syslog4j-graylog2
阅读 19
收藏 0
点赞 0
评论 0
public Log4jSyslogBackLogHandler(String loggerName, LoggerFactory loggerFactory, boolean appendReason) {
if (loggerName == null) {
throw new SyslogRuntimeException("loggerName cannot be null");
}
if (loggerFactory == null) {
throw new SyslogRuntimeException("loggerFactory cannot be null");
}
this.logger = Logger.getLogger(loggerName, loggerFactory);
this.appendReason = appendReason;
initialize();
}
Category.java 文件源码
项目:logging-log4j2
阅读 25
收藏 0
点赞 0
评论 0
static Logger getInstance(final LoggerContext context, final String name, final LoggerFactory factory) {
final ConcurrentMap<String, Logger> loggers = getLoggersMap(context);
Logger logger = loggers.get(name);
if (logger != null) {
return logger;
}
logger = factory.makeNewLoggerInstance(name);
final Logger prev = loggers.putIfAbsent(name, logger);
return prev == null ? logger : prev;
}
VoltLoggerFactory.java 文件源码
项目:sstore-soft
阅读 22
收藏 0
点赞 0
评论 0
public static LoggerFactory instance() {
return m_instance;
}