1 package org.tanukisoftware.wrapper.test; 2 3 45 46 import org.tanukisoftware.wrapper.WrapperManager; 47 48 53 public class LogOutput { 54 private static void sleep() { 55 try { 56 Thread.sleep(2000); 57 } catch (InterruptedException e) {} 58 } 59 60 63 public static void main(String [] args) { 64 System.out.println("Test the various log levels..."); 65 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_DEBUG, "Debug output"); 66 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, "Info output"); 67 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_STATUS, "Status output"); 68 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_WARN, "Warn output"); 69 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_ERROR, "Error output"); 70 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_FATAL, "Fatal output"); 71 72 sleep(); 75 76 System.out.println("Put the logger through its paces..."); 77 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, "Special C characters in %s %d % %%"); 78 sleep(); 79 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, ""); 80 sleep(); 81 82 String sa = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; 83 StringBuffer sb = new StringBuffer (); 84 for (int i = 0; i < 100; i++) { 85 sb.append(sa); 86 } 87 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, sb.toString()); 88 sleep(); 89 90 sb = new StringBuffer (); 91 for (int i = 0; i < 100; i++) { 92 sb.append(sa); 93 sb.append("\n"); 94 } 95 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, sb.toString()); 96 sleep(); 97 98 for (int i = 0; i < 100; i++) { 99 WrapperManager.log(WrapperManager.WRAPPER_LOG_LEVEL_INFO, sa); 100 } 101 } 102 } 103 104 | Popular Tags |