mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
use slf4j instead of java.util.logging
This commit is contained in:
@@ -68,7 +68,7 @@ public class ContextListener extends GuiceServletContextListener
|
||||
public void contextInitialized(ServletContextEvent servletContextEvent)
|
||||
{
|
||||
|
||||
// enableDebugLogging();
|
||||
enableDebugLogging();
|
||||
webPluginContext =
|
||||
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ package sonia.scm;
|
||||
import com.google.inject.multibindings.Multibinder;
|
||||
import com.google.inject.servlet.ServletModule;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.api.rest.UriExtensionsConfig;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.cache.CacheRepositoryManagerDecorator;
|
||||
@@ -40,8 +43,6 @@ import java.io.IOException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -81,6 +82,10 @@ public class ScmServletModule extends ServletModule
|
||||
PATTERN_SCRIPT,
|
||||
PATTERN_STYLESHEET, "*.json", "*.xml", "*.txt" };
|
||||
|
||||
/** Field description */
|
||||
private static Logger logger =
|
||||
LoggerFactory.getLogger(ScmServletModule.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -119,8 +124,7 @@ public class ScmServletModule extends ServletModule
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(ScmServletModule.class.getName()).log(Level.SEVERE,
|
||||
null, ex);
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
for (Class<? extends RepositoryHandler> handler :
|
||||
|
||||
@@ -9,19 +9,19 @@ package sonia.scm.filter;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.web.filter.HttpFilter;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.util.WebUtil;
|
||||
import sonia.scm.web.filter.HttpFilter;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletContext;
|
||||
@@ -39,7 +39,7 @@ public class StaticResourceFilter extends HttpFilter
|
||||
|
||||
/** Field description */
|
||||
private static final Logger logger =
|
||||
Logger.getLogger(StaticResourceFilter.class.getName());
|
||||
LoggerFactory.getLogger(StaticResourceFilter.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -83,13 +83,13 @@ public class StaticResourceFilter extends HttpFilter
|
||||
|
||||
if (!WebUtil.isModified(request, resource))
|
||||
{
|
||||
if (logger.isLoggable(Level.FINEST))
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
StringBuilder msg = new StringBuilder("return ");
|
||||
|
||||
msg.append(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
msg.append(" for ").append(uri);
|
||||
logger.finest(msg.toString());
|
||||
logger.debug(msg.toString());
|
||||
}
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
package sonia.scm.util;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
@@ -18,8 +23,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -80,8 +83,7 @@ public class WebUtil
|
||||
"EEE, dd MMM yyyy HH:mm:ss zzz";
|
||||
|
||||
/** Field description */
|
||||
private static final Logger logger =
|
||||
Logger.getLogger(WebUtil.class.getName());
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebUtil.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -212,19 +214,11 @@ public class WebUtil
|
||||
}
|
||||
catch (ParseException ex)
|
||||
{
|
||||
if (logger.isLoggable(Level.WARNING))
|
||||
{
|
||||
logger.log(Level.WARNING, null, ex);
|
||||
}
|
||||
logger.warn(ex.getMessage(), ex);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
logger.warning(dateString);
|
||||
|
||||
if (logger.isLoggable(Level.WARNING))
|
||||
{
|
||||
logger.log(Level.WARNING, dateString, ex);
|
||||
}
|
||||
logger.warn(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user