make test logging working

This commit is contained in:
Olivier Lamy 2015-01-30 14:59:15 +11:00
parent 8bdcfbb8a0
commit 0e1a45a716
9 changed files with 40 additions and 15 deletions

View File

@ -71,7 +71,7 @@
<properties>
<springVersion>4.1.4.RELEASE</springVersion>
<slf4jVersion>1.7.7</slf4jVersion>
<slf4jVersion>1.7.10</slf4jVersion>
<log4j2Version>2.1</log4j2Version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -663,7 +663,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
@ -673,7 +673,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.6.0</version>
<version>1.7.1</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -739,6 +739,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx256m -Xms256m</argLine>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>

View File

@ -175,6 +175,19 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2Version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
@ -237,7 +250,7 @@
org.apache.archiva.redback.users;version=${project.version},
org.apache.commons.io;version="[1.4,2)",
org.apache.commons.lang;version="[2.6,3)",
org.apache.cxf*;version="[3.0.3)",
org.apache.cxf*;version="[3.0.3,4)",
com.fasterxml.jackson.databind;version="[2.2,3)",
org.codehaus.plexus.util;version="[3,4)",
org.springframework*;version="[3,4)",

View File

@ -37,7 +37,7 @@ import java.lang.reflect.Method;
public abstract class AbstractInterceptor
{
private Logger log = LoggerFactory.getLogger( getClass() );
private final Logger log = LoggerFactory.getLogger( getClass() );
@Context
private HttpServletRequest httpServletRequest;

View File

@ -71,7 +71,7 @@ public class AuthenticationInterceptor
@Named(value = "httpAuthenticator#basic")
private HttpBasicAuthentication httpAuthenticator;
private Logger log = LoggerFactory.getLogger( getClass() );
private final Logger log = LoggerFactory.getLogger( getClass() );
public void filter( ContainerRequestContext containerRequestContext )
{

View File

@ -26,7 +26,8 @@ import org.apache.cxf.message.Message;
* @author Olivier Lamy
* @since 1.3
*/
public class DebugJAXRSInInterceptor extends JAXRSInInterceptor
public class DebugJAXRSInInterceptor
extends JAXRSInInterceptor
{
@Override
public void handleMessage( Message message )

View File

@ -62,7 +62,7 @@ public class PermissionsInterceptor
@Named( value = "httpAuthenticator#basic" )
private HttpBasicAuthentication httpAuthenticator;
private Logger log = LoggerFactory.getLogger( getClass() );
private final Logger log = LoggerFactory.getLogger( getClass() );
public void filter( ContainerRequestContext containerRequestContext )
{
@ -151,6 +151,7 @@ public class PermissionsInterceptor
{
log.debug( "user {} not authenticated", securitySession.getUser().getUsername() );
}
return;
}
}
else

View File

@ -32,17 +32,19 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
/**
* @author Olivier Lamy
* @since 1.4
*/
@Service( "threadLocalUserCleaner#rest" )
@Provider
public class ThreadLocalUserCleaner
extends AbstractPhaseInterceptor<Message>
implements PhaseInterceptor<Message>
{
private Logger log = LoggerFactory.getLogger( getClass() );
private final Logger log = LoggerFactory.getLogger( getClass() );
public ThreadLocalUserCleaner( String phase )
{

View File

@ -41,6 +41,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.springframework.web.context.ContextLoaderListener;
import javax.ws.rs.core.MediaType;
@ -98,6 +99,10 @@ public abstract class AbstractRestServicesTest
throws Exception
{
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
tomcat = new Tomcat();
tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) );
tomcat.setPort( 0 );

View File

@ -17,24 +17,26 @@
~ specific language governing permissions and limitations
~ under the License.
-->
<configuration> <!-- status="debug" -->
<configuration status="debug">
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
</Console>
</appenders>
<loggers>
<logger name="org.springframework" level="info"/>
<logger name="org.apache.cxf" level="info"/>
<logger name="org.springframework" level="error"/>
<logger name="org.apache.archiva.redback.components.cache" level="error"/>
<logger name="org.apache.archiva.redback.rest.services.interceptors" level="debug"/>
<logger name="JPOX" level="ERROR"/>
<root level="info">
<appender-ref ref="console"/>
</root>
</loggers>
</configuration>