本文整理了Java中org.apache.log4j.Hierarchy.<init>()
方法的一些代码示例,展示了Hierarchy.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hierarchy.<init>()
方法的具体详情如下:
包路径:org.apache.log4j.Hierarchy
类名称:Hierarchy
方法名:<init>
[英]Create a new logger hierarchy.
[中]创建新的记录器层次结构。
代码示例来源:origin: log4j/log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: log4j/log4j
LoggerRepository configureHierarchy(InetAddress inetAddress) {
cat.info("Locating configuration file for "+inetAddress);
// We assume that the toSting method of InetAddress returns is in
// the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
String s = inetAddress.toString();
int i = s.indexOf("/");
if(i == -1) {
cat.warn("Could not parse the inetAddress ["+inetAddress+
"]. Using default hierarchy.");
return genericHierarchy();
} else {
String key = s.substring(0, i);
File configFile = new File(dir, key+CONFIG_FILE_EXT);
if(configFile.exists()) {
Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG));
hierarchyMap.put(inetAddress, h);
new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
return h;
} else {
cat.warn("Could not find config file ["+configFile+"].");
return genericHierarchy();
}
}
}
代码示例来源:origin: Alluxio/alluxio
Hierarchy clientHierarchy = new Hierarchy(new RootLogger(level));
代码示例来源:origin: apache/log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: apache/log4j
LoggerRepository configureHierarchy(InetAddress inetAddress) {
cat.info("Locating configuration file for "+inetAddress);
// We assume that the toSting method of InetAddress returns is in
// the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
String s = inetAddress.toString();
int i = s.indexOf("/");
if(i == -1) {
cat.warn("Could not parse the inetAddress ["+inetAddress+
"]. Using default hierarchy.");
return genericHierarchy();
} else {
String key = s.substring(0, i);
File configFile = new File(dir, key+CONFIG_FILE_EXT);
if(configFile.exists()) {
Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG));
hierarchyMap.put(inetAddress, h);
new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
return h;
} else {
cat.warn("Could not find config file ["+configFile+"].");
return genericHierarchy();
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger((Level) Priority.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
LoggerRepository configureHierarchy(InetAddress inetAddress) {
cat.info("Locating configuration file for "+inetAddress);
// We assume that the toSting method of InetAddress returns is in
// the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
String s = inetAddress.toString();
int i = s.indexOf("/");
if(i == -1) {
cat.warn("Could not parse the inetAddress ["+inetAddress+
"]. Using default hierarchy.");
return genericHierarchy();
} else {
String key = s.substring(0, i);
File configFile = new File(dir, key+CONFIG_FILE_EXT);
if(configFile.exists()) {
Hierarchy h = new Hierarchy(new RootLogger((Level) Priority.DEBUG));
hierarchyMap.put(inetAddress, h);
new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
return h;
} else {
cat.warn("Could not find config file ["+configFile+"].");
return genericHierarchy();
}
}
}
代码示例来源:origin: org.terracotta/terracotta-l1-ee
private void resolveClasses() {
// This is to help a deadlock in log4j (see MNK-3461, MNK-3512)
Logger l = new RootLogger(Level.ALL);
Hierarchy h = new Hierarchy(l);
l.addAppender(new WriterAppender(new PatternLayout(TCLogging.FILE_AND_JMX_PATTERN), new OutputStream() {
@Override
public void write(int b) {
//
}
}));
l.debug(h.toString(), new Throwable());
}
代码示例来源:origin: org.terracotta/terracotta-ee
private void resolveClasses() {
// This is to help a deadlock in log4j (see MNK-3461, MNK-3512)
Logger l = new RootLogger(Level.ALL);
Hierarchy h = new Hierarchy(l);
l.addAppender(new WriterAppender(new PatternLayout(TCLogging.FILE_AND_JMX_PATTERN), new OutputStream() {
@Override
public void write(int b) {
//
}
}));
l.debug(h.toString(), new Throwable());
}
代码示例来源:origin: org.echocat.jomon/runtime
@Nonnull
protected LoggerRepository createRepositoryFor(@SuppressWarnings("UnusedParameters") @Nonnull Log4JBasedLoggingEnvironmentConfiguration requirement, @Nonnull Reader reader) throws IOException {
final LoggerRepository result = new Hierarchy(new RootLogger(INFO));
configure(reader, result);
return result;
}
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
/**
* This constructor creates a completely independent
* Log4J hierarchy. If you want to log to an existing
* Log4J hierarchy please use Log4JAdapter. This class
* always creates a new private hierarchy and configures
* it all by itself.
*/
public Log4JConfAdapter()
{
/**
* Copied from org.apache.log4j.LogManager.
*/
super( new Hierarchy( new RootCategory( Level.ALL ) ) );
}
代码示例来源:origin: org.apache.activemq/activemq-all
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: org.apache/log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: apache-log4j/log4j
LoggerRepository genericHierarchy() {
if(genericHierarchy == null) {
File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
if(f.exists()) {
genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
} else {
cat.warn("Could not find config file ["+f+
"]. Will use the default hierarchy.");
genericHierarchy = LogManager.getLoggerRepository();
}
}
return genericHierarchy;
}
}
代码示例来源:origin: net.dataforte/dataforte-commons
/**
* Register with this repository selector.
*/
public static synchronized void init() {
if (!initialized) // set the global RepositorySelector
{
defaultRepository = LogManager.getLoggerRepository();
RepositorySelector theSelector = new ContextRepositorySelector();
LogManager.setRepositorySelector(theSelector, guard);
initialized = true;
}
Hierarchy hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
loadLog4JConfig(hierarchy, loader);
} catch (Exception e) {
throw new RuntimeException("Could not initialize ContextRepositorySelector", e);
}
repositories.put(loader, hierarchy);
}
代码示例来源:origin: fbacchella/jrds
@Test
public void hierarchy() throws Exception {
Hierarchy h = new Hierarchy(new RootLogger(Level.ALL));
Document log4jdom = Tools.parseRessource("log4j.xml");
DOMConfigurator configurator = new DOMConfigurator();
configurator.doConfigure(log4jdom.getDocumentElement(), h);
PropertyPrinter printer = new PropertyPrinter(new PrintWriter(System.out));
printer.print(new PrintWriter(System.out));
}
内容来源于网络,如有侵权,请联系作者删除!