| | |
| | | |
| | | /** |
| | | * Writes a message to the error log using the provided information. |
| | | * |
| | | * @param message The message to be logged. |
| | | */ |
| | | // TODO : remove |
| | | public static void logError(LocalizableMessage message) |
| | | { |
| | | log("category", Severity.SEVERE_ERROR, message, null); |
| | | } |
| | | |
| | | /** |
| | | * Writes a message to the error log using the provided information. |
| | | * <p> |
| | | * Category is defined using either short name (used for classes in well |
| | | * defined packages) or fully qualified classname. Conversion to short name is |
| | | * done automatically when loggers are created, see |
| | | * {@code LoggingCategoryNames} for list of existing short names. |
| | | * |
| | | * @param category |
| | | * The category of the message. |
| | | * The category of the message, which is either a classname or a |
| | | * simple category name defined in {@code LoggingCategoryNames} |
| | | * class. |
| | | * @param severity |
| | | * The severity of the message. |
| | | * @param message |
| | |
| | | * @param exception |
| | | * The exception to be logged. May be {@code null}. |
| | | */ |
| | | public static void log(String category, Severity severity, LocalizableMessage message, Throwable exception) |
| | | static void log(String category, Severity severity, LocalizableMessage message, Throwable exception) |
| | | { |
| | | for (ErrorLogPublisher publisher : loggerStorage.getLogPublishers()) |
| | | for (ErrorLogPublisher<?> publisher : loggerStorage.getLogPublishers()) |
| | | { |
| | | publisher.log(category, severity, message, exception); |
| | | } |
| | |
| | | * Check if logging is enabled for the provided category and severity. |
| | | * |
| | | * @param category |
| | | * The category of logging event. |
| | | * The category of the logging event, which is either a classname or |
| | | * a simple category name defined in {@code LoggingCategoryNames} |
| | | * class. |
| | | * @param severity |
| | | * The severity of logging event. |
| | | * The severity of logging event. |
| | | * @return {@code true} if logger is enabled |
| | | */ |
| | | public static boolean isEnabledFor(String category, Severity severity) |
| | | static boolean isEnabledFor(String category, Severity severity) |
| | | { |
| | | if (Thread.currentThread() instanceof DirectoryThread) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | for (ErrorLogPublisher publisher : loggerStorage.getLogPublishers()) |
| | | for (ErrorLogPublisher<ErrorLogPublisherCfg> publisher : loggerStorage.getLogPublishers()) |
| | | { |
| | | if (publisher.isEnabledFor(category, severity)) |
| | | { |