Logging related methods.
| 17 | * Logging related methods. |
| 18 | */ |
| 19 | public class LogSupport { |
| 20 | private static boolean debug = false; |
| 21 | private static Logger logger; |
| 22 | private static final Level level = Level.FINE; |
| 23 | |
| 24 | static { |
| 25 | try { |
| 26 | debug = Boolean.getBoolean("javax.activation.debug"); |
| 27 | } catch (Throwable t) { |
| 28 | // ignore any errors |
| 29 | } |
| 30 | logger = Logger.getLogger("javax.activation"); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Constructor. |
| 35 | */ |
| 36 | private LogSupport() { |
| 37 | // private constructor, can't create instances |
| 38 | } |
| 39 | |
| 40 | public static void log(String msg) { |
| 41 | if (debug) |
| 42 | System.out.println(msg); |
| 43 | logger.log(level, msg); |
| 44 | } |
| 45 | |
| 46 | public static void log(String msg, Throwable t) { |
| 47 | if (debug) |
| 48 | System.out.println(msg + "; Exception: " + t); |
| 49 | logger.log(level, msg, t); |
| 50 | } |
| 51 | |
| 52 | public static boolean isLoggable() { |
| 53 | return debug || logger.isLoggable(level); |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected