dependencia - spring security web
Spring behind the scenes logging (1)
Uso log4j2
y no puedo iniciar sesión desde la primavera. cuando escribo mi propio logger.debug(...);
funciona pero es lo mismo que System.out.println(...);
.
Quiero saber qué pasó detrás de escena en la primavera. muestra el error creado de bean o debuggig como 400 ...
Intento esta Conf, pero no pasó nada:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="ALL">
<AppenderRef ref="CONSOLE"/>
</Root>
<logger name="org.springframework" level="ALL">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver" level="ALL">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.beans.factory.support.DefaultListableBeanFactory" level="ALL">
<appender-ref ref="CONSOLE"/>
</logger>
</Loggers>
</Configuration>
pom.xml
<!-- log4j2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0-rc2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-rc2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.0-rc2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.0-rc2</version>
</dependency>
Registro de inicio:
juil. 09, 2014 4:42:57 PM org.apache.catalina.core.AprLifecycleListener init
Infos: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:/Program Files/Java/jdk1.7.0_45/bin;C:/Windows/Sun/Java/bin;C:/Windows/system32;C:/Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:/Program Files/Common Files/Microsoft Shared/Windows Live;C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/WindowsPowerShell/v1.0/;C:/Program Files/Broadcom/Broadcom 802.11/Driver;D:/apache-maven-3.1.1/bin;C:/wamp/bin/mysql/mysql5.5.24/bin;C:/Program Files/Java/jdk1.7.0_45/bin;;D:/AO Project/eclipse;;.
juil. 09, 2014 4:42:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avertissement: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ''source'' to ''org.eclipse.jst.jee.server:AO'' did not find a matching property.
juil. 09, 2014 4:42:57 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["http-nio-8080"]
juil. 09, 2014 4:42:57 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Infos: Using a shared selector for servlet write/read
juil. 09, 2014 4:42:57 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["ajp-nio-8009"]
juil. 09, 2014 4:42:57 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Infos: Using a shared selector for servlet write/read
juil. 09, 2014 4:42:57 PM org.apache.catalina.startup.Catalina load
Infos: Initialization processed in 670 ms
juil. 09, 2014 4:42:57 PM org.apache.catalina.core.StandardService startInternal
Infos: Démarrage du service Catalina
juil. 09, 2014 4:42:57 PM org.apache.catalina.core.StandardEngine startInternal
Infos: Starting Servlet Engine: Apache Tomcat/8.0.9
juil. 09, 2014 4:43:02 PM org.apache.catalina.core.ApplicationContext log
Infos: Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.
juil. 09, 2014 4:43:03 PM org.apache.catalina.core.ApplicationContext log
Infos: No Spring WebApplicationInitializer types detected on classpath
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
juil. 09, 2014 4:43:03 PM org.apache.catalina.core.ApplicationContext log
Infos: Initializing Spring root WebApplicationContext
juil. 09, 2014 4:43:04 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: persistenceYous
...]
juil. 09, 2014 4:43:05 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.5.Final}
juil. 09, 2014 4:43:05 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
juil. 09, 2014 4:43:05 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
juil. 09, 2014 4:43:06 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
juil. 09, 2014 4:43:06 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
juil. 09, 2014 4:43:07 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
juil. 09, 2014 4:43:11 PM org.apache.catalina.core.ApplicationContext log
Infos: Log4jServletContextListener ensuring that Log4j starts up properly.
juil. 09, 2014 4:43:11 PM org.apache.catalina.core.ApplicationContext log
Infos: Log4jServletFilter initialized.
juil. 09, 2014 4:43:11 PM org.apache.catalina.core.ApplicationContext log
Infos: Initializing Spring FrameworkServlet ''mvc-dispatcher''
juil. 09, 2014 4:43:13 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["http-nio-8080"]
juil. 09, 2014 4:43:13 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["ajp-nio-8009"]
juil. 09, 2014 4:43:13 PM org.apache.catalina.startup.Catalina start
Infos: Server startup in 15715 ms
El problema está resuelto Creo que el error proviene de esto
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Tengo que enrutar los registros de slf4j
a log4j
porque creo que Spring
usa slf4j
para el registro. Así que agrego log4j-slf4j-impl
jar y FINALMENTE funciona :-)
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.0-rc2</version>
</dependency>
PD: ¿Por qué creo que Spring
utiliza slf4j
lugar de common logging
porque agrego log4j-jcl
jar pero no pasó nada.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.0-rc2</version>
</dependency>