List of usage examples for java.util.logging Level INFO
Level INFO
To view the source code for java.util.logging Level INFO.
Click Source Link
From source file:Main.java
public static void main(String[] argv) throws Exception { Level level1 = Level.INFO; Level level2 = Level.CONFIG; if (level1.intValue() > level2.intValue()) { System.out.println("level1 is more severe"); } else if (level1.intValue() < level2.intValue()) { System.out.println("level2 is more severe"); } else {/*from www .j a v a 2 s . c o m*/ System.out.println("level1 == level2"); } }
From source file:Main.java
public static void main(String[] args) { logger.logp(Level.INFO, "InfoLogging2", "main", "Logging an INFO-level message"); }
From source file:Main.java
public static void main(String args[]) throws Exception { XMLFormatter formatter = new XMLFormatter(); LogRecord record = new LogRecord(Level.INFO, "XML message.."); FileHandler handler = new FileHandler("newxml.xml"); handler.setFormatter(formatter);/*from w ww.j ava 2 s.c o m*/ handler.publish(record); handler.flush(); }
From source file:Main.java
public static void main(String args[]) throws Exception { LogManager lm = LogManager.getLogManager(); Logger logger;//ww w .j av a 2 s. c o m FileHandler fh = new FileHandler("log_test.txt"); logger = Logger.getLogger("LoggingExample1"); lm.addLogger(logger); logger.setLevel(Level.INFO); fh.setFormatter(new XMLFormatter()); logger.addHandler(fh); //logger.setUseParentHandlers(false); logger.log(Level.INFO, "test 1"); logger.log(Level.INFO, "test 2"); logger.log(Level.INFO, "test 3"); fh.close(); }
From source file:LoggingExample1.java
public static void main(String args[]) { try {// ww w .j a v a 2 s . c o m LogManager lm = LogManager.getLogManager(); Logger logger; FileHandler fh = new FileHandler("log_test.txt"); logger = Logger.getLogger("LoggingExample1"); lm.addLogger(logger); logger.setLevel(Level.INFO); fh.setFormatter(new XMLFormatter()); logger.addHandler(fh); //logger.setUseParentHandlers(false); logger.log(Level.INFO, "test 1"); logger.log(Level.INFO, "test 2"); logger.log(Level.INFO, "test 3"); fh.close(); } catch (Exception e) { System.out.println("Exception thrown: " + e); e.printStackTrace(); } }
From source file:org.my.spring.batch.java.config.demo.Main.java
public static void main(String[] args) { //System.exit(SpringApplication.exit(SpringApplication.run(MyBatchConfiguration.class, args))); logger.log(Level.INFO, "extracting job parameters from command line arguments {0}", args); JobParameters jobParameters = parseJobParameters(args); String basePackage = Main.class.getPackage().getName(); logger.log(Level.INFO, "scanning {0} for classes with bean definitions", basePackage); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(basePackage); Job job1 = context.getBean("job1", Job.class); JobLauncher jobLauncher = context.getBean(JobLauncher.class); try {//w w w. j a v a 2 s. c om JobExecution jobExecution = jobLauncher.run(job1, jobParameters); logger.log(Level.INFO, "job execution {0} ended with status: {1}", new Object[] { jobExecution.getId(), jobExecution.getStatus() }); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); } }
From source file:com.mkyong.AppJobAllExport.java
/** * @param args the command line arguments */// w w w.j a va 2s . c o m public static void main(String[] args) { fLogger.log(Level.INFO, "Export all csv to mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvexport/job-all-export.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("exportJob"); try { JobExecution execution = jobLauncher.run(job, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobAllImport.java
/** * @param args the command line arguments */// w ww . j a v a 2s.c o m public static void main(String[] args) { fLogger.log(Level.INFO, "Import all csv to mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-all-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("importJob"); try { JobExecution execution = jobLauncher.run(job, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobCityImport.java
/** * @param args the command line arguments */// w ww . j a v a2 s .c om public static void main(String[] args) { fLogger.log(Level.INFO, "Import city csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-city-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job cityJob = (Job) context.getBean("cityImportJob"); try { JobExecution execution = jobCityLauncher.run(cityJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobReportImport.java
/** * @param args the command line arguments *//* w w w . j av a2 s . com*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import report csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-report-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job reportJob = (Job) context.getBean("reportImportJob"); try { JobExecution execution = jobCityLauncher.run(reportJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }