mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 22:15:45 +01:00
use log4j for logging configuration
This commit is contained in:
@@ -87,10 +87,16 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.6.1</version>
|
<version>1.6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.ehcache</groupId>
|
<groupId>net.sf.ehcache</groupId>
|
||||||
<artifactId>ehcache-core</artifactId>
|
<artifactId>ehcache-core</artifactId>
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ import sonia.scm.web.ScmWebPluginContext;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
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;
|
import javax.servlet.ServletContextEvent;
|
||||||
|
|
||||||
@@ -67,8 +63,6 @@ public class ContextListener extends GuiceServletContextListener
|
|||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent servletContextEvent)
|
public void contextInitialized(ServletContextEvent servletContextEvent)
|
||||||
{
|
{
|
||||||
|
|
||||||
enableDebugLogging();
|
|
||||||
webPluginContext =
|
webPluginContext =
|
||||||
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
||||||
|
|
||||||
@@ -112,24 +106,6 @@ public class ContextListener extends GuiceServletContextListener
|
|||||||
return injector;
|
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 ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
|
|||||||
17
scm-webapp/src/main/resources/log4j.properties
Normal file
17
scm-webapp/src/main/resources/log4j.properties
Normal 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
|
||||||
Reference in New Issue
Block a user