use log4j for logging configuration

This commit is contained in:
Sebastian Sdorra
2010-10-16 11:20:54 +02:00
parent 30f94d48ae
commit ecb96edda8
3 changed files with 24 additions and 25 deletions

View File

@@ -87,10 +87,16 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>

View File

@@ -25,10 +25,6 @@ import sonia.scm.web.ScmWebPluginContext;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
@@ -67,8 +63,6 @@ public class ContextListener extends GuiceServletContextListener
@Override
public void contextInitialized(ServletContextEvent servletContextEvent)
{
enableDebugLogging();
webPluginContext =
new ScmWebPluginContext(servletContextEvent.getServletContext());
@@ -112,24 +106,6 @@ public class ContextListener extends GuiceServletContextListener
return injector;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*/
private void enableDebugLogging()
{
Logger logger = LogManager.getLogManager().getLogger("");
logger.setLevel(Level.FINEST);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.FINEST);
logger.addHandler(handler);
}
//~--- fields ---------------------------------------------------------------
/** Field description */

View File

@@ -0,0 +1,17 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
log4j.rootLogger=WARN, SoniaConsole
log4j.category.sonia.scm = DEBUG
log4j.appender.SoniaConsole=org.apache.log4j.ConsoleAppender
log4j.appender.SoniaConsole.layout=org.apache.log4j.PatternLayout
log4j.appender.SoniaConsole.layout.ConversionPattern=%d %-5p [%c] - %m%n
log4j.appender.SoniaFile=org.apache.log4j.RollingFileAppender
log4j.appender.SoniaFile.layout=org.apache.log4j.PatternLayout
log4j.appender.SoniaFile.layout.ConversionPattern=%d %-5p [%c] - %m%n
log4j.appender.SoniaFile.maxFileSize=10MB
log4j.appender.SoniaFile.MaxBackupIndex=20
log4j.appender.SoniaFile.File=/sonia/scm/logs/scm.log