1 23 24 package com.sun.enterprise.tools.guiframework.util; 25 26 import java.util.logging.Level ; 27 import java.util.logging.Logger ; 28 29 30 34 public class LogUtil { 35 36 49 public static void log(Level level, String msg, Object [] params) { 50 _logger.log(level, msg, params); 51 } 52 53 54 57 public static void log(Level level, String msg, Object param1) { 58 _logger.log(level, msg, param1); 59 } 60 61 62 65 public static void log(Level level, String msg) { 66 _logger.log(level, msg); 67 } 68 69 70 73 public static void log(Level level, String msg, Throwable thrown) { 74 _logger.log(level, msg, thrown); 75 } 76 77 78 92 public static void setLevel(Level level) { 93 _logger.setLevel(level); 94 } 95 96 97 100 public static boolean isLoggable(Level level) { 101 return _logger.isLoggable(level); 102 } 103 104 105 108 public static final String FRAMEWORK_LOGGER_NAME = 109 "com.sun.enterprise.tools.guiframework"; 110 111 114 public static final String BUNDLE_NAME = 115 "LogStrings"; 116 117 120 public static final Logger _logger = Logger.getLogger( 121 FRAMEWORK_LOGGER_NAME, FRAMEWORK_LOGGER_NAME+"."+BUNDLE_NAME); 122 123 public static Level stringToLogLevel(String level) { 124 if (level == null) 125 return Level.INFO; 126 if (level.equalsIgnoreCase("FINEST")) 127 return Level.FINEST; 128 if (level.equalsIgnoreCase("FINER")) 129 return Level.FINER; 130 if (level.equalsIgnoreCase("FINE")) 131 return Level.FINE; 132 if (level.equalsIgnoreCase("CONFIG")) 133 return Level.CONFIG; 134 if (level.equalsIgnoreCase("INFO")) 135 return Level.INFO; 136 if (level.equalsIgnoreCase("WARNING")) 137 return Level.WARNING; 138 if (level.equalsIgnoreCase("SEVERE")) 139 return Level.SEVERE; 140 return Level.INFO; 141 } 142 143 144 148 public static final Level FINEST = Level.FINEST; 149 public static final Level FINER = Level.FINER; 150 public static final Level FINE = Level.FINE; 151 public static final Level CONFIG = Level.CONFIG; 152 public static final Level INFO = Level.INFO; 153 public static final Level WARNING = Level.WARNING; 154 public static final Level SEVERE = Level.SEVERE; 155 } 156 | Popular Tags |