1 23 24 43 44 package com.sun.enterprise.config.backup; 45 46 import java.util.logging.*; 47 48 51 class LoggerHelper 52 { 53 private LoggerHelper() 54 { 55 } 56 57 59 final static Logger get() 60 { 61 return logger; 63 } 64 65 67 final static void setLevel(BackupRequest req) 68 { 69 if(req.terse) 71 logger.setLevel(Level.WARNING); 72 else if(req.verbose) 73 logger.setLevel(Level.FINEST); 74 else 75 logger.setLevel(Level.INFO); 76 77 89 } 90 91 95 final static void finest(String s) { logger.finest(s); } 96 final static void finest(String s, Object o) { logger.log(Level.FINEST, s, new Object [] { o }); } 97 final static void finer(String s) { logger.finer(s); } 98 final static void finer(String s, Object o) { logger.log(Level.FINER, s, new Object [] { o }); } 99 final static void fine(String s) { logger.fine(s); } 100 final static void fine(String s, Object o) { logger.log(Level.FINE, s, new Object [] { o }); } 101 final static void info(String s) { logger.info(s); } 102 final static void info(String s, Object o) { logger.log(Level.INFO, s, new Object [] { o }); } 103 final static void warning(String s) { logger.warning(s); } 104 final static void warning(String s, Object o) { logger.log(Level.WARNING, s, new Object [] { o }); } 105 final static void severe(String s) { logger.severe(s); } 106 final static void severe(String s, Object o) { logger.log(Level.SEVERE, s, new Object [] { o }); } 107 108 110 private static Logger logger = null; 111 112 static 113 { 114 try 115 { 116 logger = Logger.getLogger("backup", Constants.loggingResourceBundle); 118 119 Handler h = new ConsoleHandler(); 122 h.setLevel(Level.FINEST); 123 logger.addHandler(h); 124 } 125 catch(Throwable t) 126 { 127 try 128 { 129 logger = Logger.getLogger("backup"); 130 logger.warning("Couldn't create Backup Logger with a resource bundle. Created a Logger without a Resource Bundle."); 131 } 132 catch(Throwable t2) 133 { 134 } 136 } 137 } 138 } 139 140 | Popular Tags |