当前位置: 首页>>代码示例>>Java>>正文


Java Logger.getAnonymousLogger方法代码示例

本文整理汇总了Java中java.util.logging.Logger.getAnonymousLogger方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.getAnonymousLogger方法的具体用法?Java Logger.getAnonymousLogger怎么用?Java Logger.getAnonymousLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.logging.Logger的用法示例。


在下文中一共展示了Logger.getAnonymousLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException {
	File inputFile = new File(args[0]);
	
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	DocumentBuilder docBuilder = dbf.newDocumentBuilder();
	Logger logger = Logger.getAnonymousLogger();
	logger.setLevel(Level.FINE);
	YateaHandler handler = new YateaHandler(logger, docBuilder);
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
	XMLUtils.ignoreDTD(spf);
    SAXParser saxParser = spf.newSAXParser();
    saxParser.parse(inputFile, handler);
    Map<String,TermCandidate> candidates = handler.getTermCandidates();
    for (TermCandidate cand : candidates.values()) {
    	System.out.println(cand.toString() + ", HEAD:" + cand.getHead());
    }
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:19,代码来源:Test.java

示例2: postman

import java.util.logging.Logger; //导入方法依赖的package包/类
@Test 
public void postman(){

    try {              
        Process process = Runtime.getRuntime().exec("/paseos-01-prueba-fotos");
        InputStream inputStream = process.getInputStream();
        BufferedReader bf= new BufferedReader(new InputStreamReader(inputStream));
        String line="";
        String ln;
        Logger log=Logger.getAnonymousLogger();
        
        while ((ln=bf.readLine()) != null) {
           log.info(ln);
            line=line.concat(ln);
        }
            
        inputStream.close();
        bf.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}
 
开发者ID:Uniandes-ISIS2603-backup,项目名称:201710-paseos_01,代码行数:23,代码来源:FotosTestIntegracion.java

示例3: main

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException{
    Thread t1 = new Thread(new Runnable() {
        public void run() {
            randomDelay();
            // Trigger Logger.<clinit>
            Logger.getAnonymousLogger();
        }
    });

    Thread t2 = new Thread(new Runnable() {
        public void run() {
            randomDelay();
            // Trigger LogManager.<clinit>
            LogManager.getLogManager();
        }
    });

    t1.start();
    t2.start();

    t1.join();
    t2.join();
    System.out.println("\nTest passed");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:LoggingDeadlock.java

示例4: initLogging

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void initLogging(boolean time) {
	
	Logger log = Logger.getAnonymousLogger();
	while (log != null) {
		for (Handler handler : log.getHandlers()) {
			log.removeHandler(handler);
		}
		if (log.getParent() == null) {
			if (time) {
				log.addHandler(new TimeLogHandler());
			} else {
				log.addHandler(new SimpleLogHandler());
			}
		}
		log = log.getParent();
	}		
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:18,代码来源:SimpleLogging.java

示例5: postman

import java.util.logging.Logger; //导入方法依赖的package包/类
@Test 
public void postman(){

    try {              
        Process process = Runtime.getRuntime().exec("/paseos-01-prueba-paseos");
        InputStream inputStream = process.getInputStream();
        BufferedReader bf= new BufferedReader(new InputStreamReader(inputStream));
        String line="";
        String ln;
        Logger log=Logger.getAnonymousLogger();
        
        while ((ln=bf.readLine()) != null) {
           log.info(ln);
            line=line.concat(ln);
        }
            
        inputStream.close();
        bf.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}
 
开发者ID:Uniandes-ISIS2603-backup,项目名称:201710-paseos_01,代码行数:23,代码来源:paseosTestIntegracion.java

示例6: main

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void main(String[] args) throws JSAPException {
//      FOR TESTING		
//		args = new String[] {
//			"-u",
//			"D:\\Games\\UT2004-Devel",
//			"-m",
//			"DM-TrainingDay",
//			"-c"			
//		};
		
		SimpleLogging.initLogging(true);
		
		log = Logger.getAnonymousLogger();
		
		initJSAP();
	    
	    header();
	    
	    readConfig(args);
	    
	    sanityChecks();
	    
	    if (convertAll) {
	    	transformAll();
	    } else {
	    	transformMaps(maps);
	    }
	    	
	}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:30,代码来源:Main.java

示例7: addFileLogging

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void addFileLogging(final String pathToFile) {
	Logger log = Logger.getAnonymousLogger();
	
	
	try {
		final PrintWriter writer = new PrintWriter(new FileWriter(new File(pathToFile)));
		
		while (log != null) {
			if (log.getParent() == null) {
				log.addHandler(new Handler() {
					
					@Override
					public void close() throws SecurityException {
						writer.close();
					}

					@Override
					public void flush() {
						writer.flush();
					}

					@Override
					public void publish(LogRecord record) {
						writer.println("[" + record.getLevel() + "] " + record.getMessage());
					}
					
				});
			}
			log = log.getParent();
		}	
		
	} catch (IOException e) {
		throw new RuntimeException("Could not open file " + new File(pathToFile).getAbsolutePath() + " for logging!", e);
	}
	
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:37,代码来源:SimpleLogging.java

示例8: testOne

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void testOne() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getAnonymousLogger();
        Logger logger1b = Logger.getAnonymousLogger();
        Bridge.changeContext();
        Logger logger2 = Logger.getAnonymousLogger();
        Logger logger2b = Logger.getAnonymousLogger();
        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger();
        Logger logger3b = new Bridge.CustomAnonymousLogger();
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger();
        Logger logger4b = new Bridge.CustomAnonymousLogger();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:TestAppletLoggerContext.java

示例9: get

import java.util.logging.Logger; //导入方法依赖的package包/类
@Override
public Logger get(Errors errors, InternalContext context, Dependency<?> dependency) {
    InjectionPoint injectionPoint = dependency.getInjectionPoint();
    return injectionPoint == null
            ? Logger.getAnonymousLogger()
            : Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:InjectorShell.java

示例10: getAnonymousLogger

import java.util.logging.Logger; //导入方法依赖的package包/类
public Logger getAnonymousLogger(String rbName) throws Exception {
    // we should not be able to find the resource in this directory via
    // getLogger calls.  The only way that would be possible given this setup
    // is that if Logger.getLogger searched up the call stack
    return Logger.getAnonymousLogger(rbName);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:LoadItUp1.java

示例11: main

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());
    Logger anonymous = Logger.getAnonymousLogger();

    final TestHandler handler = new TestHandler();
    final TestFilter filter = new TestFilter();
    final ResourceBundle bundle = ResourceBundle.getBundle(TestBundle.class.getName());
    anonymous.setLevel(Level.FINEST);
    anonymous.addHandler(handler);
    anonymous.setFilter(filter);
    anonymous.setUseParentHandlers(true);
    anonymous.setResourceBundle(bundle);

    if (anonymous.getLevel() != Level.FINEST) {
        throw new RuntimeException("Unexpected level: " + anonymous.getLevel());
    } else {
        System.out.println("Got expected level: " + anonymous.getLevel());
    }
    if (!Arrays.asList(anonymous.getHandlers()).contains(handler)) {
        throw new RuntimeException("Expected handler not found in: "
                + Arrays.asList(anonymous.getHandlers()));
    } else {
        System.out.println("Got expected handler in: " + Arrays.asList(anonymous.getHandlers()));
    }
    if (anonymous.getFilter() != filter) {
        throw new RuntimeException("Unexpected filter: " + anonymous.getFilter());
    } else {
        System.out.println("Got expected filter: " + anonymous.getFilter());
    }
    if (!anonymous.getUseParentHandlers()) {
        throw new RuntimeException("Unexpected flag: " + anonymous.getUseParentHandlers());
    } else {
        System.out.println("Got expected flag: " + anonymous.getUseParentHandlers());
    }
    if (anonymous.getResourceBundle() != bundle) {
        throw new RuntimeException("Unexpected bundle: " + anonymous.getResourceBundle());
    } else {
        System.out.println("Got expected bundle: " + anonymous.getResourceBundle());
    }
    try {
        anonymous.setParent(Logger.getLogger("foo.bar"));
        throw new RuntimeException("Expected SecurityException not raised!");
    } catch (SecurityException x) {
        System.out.println("Got expected exception: " + x);
    }
    if (anonymous.getParent() != Logger.getLogger("")) {
        throw new RuntimeException("Unexpected parent: " + anonymous.getParent());
    } else {
        System.out.println("Got expected parent: " + anonymous.getParent());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:52,代码来源:TestAnonymousLogger.java

示例12: main

import java.util.logging.Logger; //导入方法依赖的package包/类
public static void main( String[] args ) {

if (args.length == 0) {
	printHelp();
	System.exit(1);
}

SimpleLogging.initLogging();
Logger log = Logger.getAnonymousLogger();

log.info("=====================");
log.info("JavaDoc Stripper Tool");
log.info("=====================");
log.info("");
log.info("Reading configuration...");

Substitution multiLineCommentSubst = new Substitution();
multiLineCommentSubst.setCaseSensitive(false);
multiLineCommentSubst.setMultiLine(true);
multiLineCommentSubst.setReMatch(multiLineCommentPattern);
multiLineCommentSubst.setReSubst("");

Substitution singleLineCommentSubst = new Substitution();
singleLineCommentSubst.setCaseSensitive(false);
singleLineCommentSubst.setMultiLine(false);
singleLineCommentSubst.setReMatch(singleLineCommentPattern);
singleLineCommentSubst.setReSubst("");

boolean recursive = "-r".equals(args[0]);

if (recursive) {
	log.info("'-r' paramter detected, will be recursively descending to subdirs.");
} else {
	log.info("'-r' parameter not specified, won't recursively descend to subdirs.");
}

RewriteFilesConfig config = new RewriteFilesConfig();

int i = recursive ? 1 : 0;
for (; i < args.length; ++i) {
	File file = new File(args[i]);
	if (!file.exists()) {
		log.warning("File/Dir (" + (i+1) + ". param) does not exist, ommiting: " + args[i] + " -> " + file.getAbsolutePath());
		continue;
	}
	
	IncludeDirForSubstitutions dir = new IncludeDirForSubstitutions();			
	if (file.isDirectory()) {
		log.info("Adding configuration for directory (" + (i+1) + ". param): " + args[i] + " -> " + file.getAbsolutePath());
		dir.setSubdirs(recursive);
		dir.setDir(file);
		dir.getIncludeFiles().add("*.java");
		dir.getSubstitutions().add(singleLineCommentSubst);
		dir.getSubstitutions().add(multiLineCommentSubst);								
	} else {
		log.info("Adding configuration for file      (" + (i+1) + ". param): " + args[i] + " -> " + file.getAbsolutePath());
		dir.setSubdirs(false);
		dir.setDir(file.getParentFile());
		dir.getIncludeFiles().add(file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(fileSeparator)+1));
		dir.getSubstitutions().add(singleLineCommentSubst);
		dir.getSubstitutions().add(multiLineCommentSubst);
	}		
	
	config.getDirs().add(dir);
}

RewriteFiles rewriter = new RewriteFiles(config);
rewriter.setLog(log);
log.info("STRIPPING!");
rewriter.rewrite();

log.info("");
log.info("DONE!");

System.exit(0);
  }
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:77,代码来源:JavaDocStripper.java

示例13: get

import java.util.logging.Logger; //导入方法依赖的package包/类
public Logger get(Errors errors, InternalContext context, Dependency<?> dependency, boolean linked) {
  InjectionPoint injectionPoint = dependency.getInjectionPoint();
  return injectionPoint == null
      ? Logger.getAnonymousLogger()
      : Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
 
开发者ID:maetrive,项目名称:businessworks,代码行数:7,代码来源:InjectorShell.java

示例14: getListener

import java.util.logging.Logger; //导入方法依赖的package包/类
@NonNull
@Override
public TaskListener getListener() {
    return new LogTaskListener(Logger.getAnonymousLogger(), Level.INFO);
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:6,代码来源:ASFGitSCMNavigatorTest.java

示例15: get

import java.util.logging.Logger; //导入方法依赖的package包/类
@Override
public Logger get() {
    return Logger.getAnonymousLogger();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:InjectorShell.java


注:本文中的java.util.logging.Logger.getAnonymousLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。