1 29 30 package com.caucho.log; 31 32 import com.caucho.management.server.AbstractManagedObject; 33 import com.caucho.management.server.LoggerMXBean; 34 import com.caucho.util.L10N; 35 36 import java.util.logging.Level ; 37 import java.util.logging.Logger ; 38 39 42 public class LoggerAdmin extends AbstractManagedObject implements LoggerMXBean 43 { 44 private static final L10N L = new L10N(LoggerAdmin.class); 45 46 private final Logger _logger; 47 private final ClassLoader _loader; 48 private Level _level; 49 50 LoggerAdmin(Logger logger) 51 { 52 _logger = logger; 53 54 _loader = Thread.currentThread().getContextClassLoader(); 55 } 56 57 60 public String getName() 61 { 62 return _logger.getName(); 63 } 64 65 68 public void setLevel(String levelName) 69 { 70 Level level; 71 72 if (levelName.equals("off")) 73 level = Level.OFF; 74 else if (levelName.equals("severe")) 75 level = Level.SEVERE; 76 else if (levelName.equals("warning")) 77 level = Level.WARNING; 78 else if (levelName.equals("info")) 79 level = Level.INFO; 80 else if (levelName.equals("config")) 81 level = Level.CONFIG; 82 else if (levelName.equals("fine")) 83 level = Level.FINE; 84 else if (levelName.equals("finer")) 85 level = Level.FINER; 86 else if (levelName.equals("finest")) 87 level = Level.FINEST; 88 else if (levelName.equals("all")) 89 level = Level.ALL; 90 else 91 throw new IllegalArgumentException (L.l("`{0}' is an unknown log level. Log levels are:\noff - disable logging\nsevere - severe errors only\nwarning - warnings\ninfo - information\nconfig - configuration\nfine - fine debugging\nfiner - finer debugging\nfinest - finest debugging\nall - all debugging", 92 levelName)); 93 } 94 95 public String getLevel() 96 { 97 return null; 98 } 99 } 100 | Popular Tags |