[ https://issues.apache.org/jira/browse/MTOMCAT-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173968#comment-13173968 ]
Morten Haraldsen edited comment on MTOMCAT-110 at 12/21/11 1:29 PM: -------------------------------------------------------------------- Hi again, I thought I should simplify your task a bit, and I wrote the following snippet: private void installLogger(String loggerName) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { if ("slf4j".equals(loggerName)) { try { // Check class is available final Class<?> clazz = Class.forName("org.slf4j.bridge.SLF4JBridgeHandler"); // Remove all JUL handlers java.util.logging.LogManager.getLogManager().reset(); // Install slf4j bridge handler final Method method = clazz.getMethod("install", null); method.invoke(null); } catch (ClassNotFoundException e) { // TODO: Notify that the class was missing } } else { // TODO: Notify unsupported logger type } } was (Author: xaer): Hi again, I thought I should simplify your task a bit, and I wrote the following snippet: private void installLogger(String loggerName) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { if ("slf4j".equals(loggerName)) { Class<?> clazz; try { // Check class is available clazz = Class.forName("org.slf4j.bridge.SLF4JBridgeHandler"); // Remove all JUL handlers java.util.logging.LogManager.getLogManager().reset(); // Install slf4j bridge handler final Method method = clazz.getMethod("install", String.class); method.invoke(null); } catch (ClassNotFoundException e) { // TODO: Notify that the class was missing } } else { // TODO: Notify unsupported logger type } } > Support Slf4j bridge logger > --------------------------- > > Key: MTOMCAT-110 > URL: https://issues.apache.org/jira/browse/MTOMCAT-110 > Project: Apache Tomcat Maven Plugin > Issue Type: New Feature > Reporter: Morten Haraldsen > Original Estimate: 2h > Remaining Estimate: 2h > > As a lot of web-applications use slf4j for logging, it would be nice if you > could support this as a Mojo parameter, like <logging>slf4j</logging> > This should trigger something like: > java.util.logging.LogManager.getLogManager().reset(); > SLF4JBridgeHandler.install(); > (requires org.slf4j:jul-to-slf4j on the classpath) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org