use of org.apache.commons.logging.Log in project javaee7-samples by javaee-samples.
the class SecureServletTest method enableSSLDebug.
private static void enableSSLDebug() {
System.setProperty("javax.net.debug", "ssl:handshake");
System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog", "debug");
Logger.getLogger("com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory").setLevel(FINEST);
Logger.getLogger("org.apache.http.conn.ssl.SSLConnectionSocketFactory").setLevel(FINEST);
Log logger = LogFactory.getLog(org.apache.http.conn.ssl.SSLConnectionSocketFactory.class);
((Jdk14Logger) logger).getLogger().setLevel(FINEST);
logger = LogFactory.getLog(com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory.class);
((Jdk14Logger) logger).getLogger().setLevel(FINEST);
Logger.getGlobal().getParent().getHandlers()[0].setLevel(FINEST);
}
use of org.apache.commons.logging.Log in project javaee7-samples by javaee-samples.
the class SecureServletTest method enableSSLDebug.
private static void enableSSLDebug() {
System.setProperty("javax.net.debug", "ssl:handshake");
System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog", "debug");
Logger.getLogger("com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory").setLevel(FINEST);
Logger.getLogger("org.apache.http.conn.ssl.SSLConnectionSocketFactory").setLevel(FINEST);
Log logger = LogFactory.getLog(org.apache.http.conn.ssl.SSLConnectionSocketFactory.class);
((Jdk14Logger) logger).getLogger().setLevel(FINEST);
logger = LogFactory.getLog(com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory.class);
((Jdk14Logger) logger).getLogger().setLevel(FINEST);
Logger.getGlobal().getParent().getHandlers()[0].setLevel(FINEST);
}
use of org.apache.commons.logging.Log in project spring-security by spring-projects.
the class DefaultJaasAuthenticationProviderTests method setUp.
@BeforeEach
public void setUp() throws Exception {
Configuration configuration = mock(Configuration.class);
this.publisher = mock(ApplicationEventPublisher.class);
this.log = mock(Log.class);
this.provider = new DefaultJaasAuthenticationProvider();
this.provider.setConfiguration(configuration);
this.provider.setApplicationEventPublisher(this.publisher);
this.provider.setAuthorityGranters(new AuthorityGranter[] { new TestAuthorityGranter() });
this.provider.afterPropertiesSet();
AppConfigurationEntry[] aces = new AppConfigurationEntry[] { new AppConfigurationEntry(TestLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, Collections.<String, Object>emptyMap()) };
given(configuration.getAppConfigurationEntry(this.provider.getLoginContextName())).willReturn(aces);
this.token = new UsernamePasswordAuthenticationToken("user", "password");
ReflectionTestUtils.setField(this.provider, "log", this.log);
}
use of org.apache.commons.logging.Log in project spring-security by spring-projects.
the class AbstractAuthenticationProcessingFilterTests method loginErrorWithInternAuthenticationServiceExceptionLogsError.
/**
* SEC-1919
*/
@Test
public void loginErrorWithInternAuthenticationServiceExceptionLogsError() throws Exception {
MockHttpServletRequest request = createMockAuthenticationRequest();
MockFilterChain chain = new MockFilterChain(true);
MockHttpServletResponse response = new MockHttpServletResponse();
Log logger = mock(Log.class);
MockAuthenticationFilter filter = new MockAuthenticationFilter(false);
ReflectionTestUtils.setField(filter, "logger", logger);
filter.exceptionToThrow = new InternalAuthenticationServiceException("Mock requested to do so");
this.successHandler.setDefaultTargetUrl("https://monkeymachine.co.uk/");
filter.setAuthenticationSuccessHandler(this.successHandler);
filter.doFilter(request, response, chain);
verify(logger).error(anyString(), eq(filter.exceptionToThrow));
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
}
use of org.apache.commons.logging.Log in project spring-security by spring-projects.
the class HttpSessionEventPublisher method extracted.
private void extracted(HttpSession session, ApplicationEvent e) {
Log log = LogFactory.getLog(LOGGER_NAME);
log.debug(LogMessage.format("Publishing event: %s", e));
getContext(session.getServletContext()).publishEvent(e);
}
Aggregations