3

I simply cannot get hibernate to log anything with the following configuration:

<dependencies>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.0.2</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.0.2</version>
  </dependency>
  <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
  </dependency>
  <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>4.3.5.Final</version>
  </dependency>
  <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>4.3.5.Final</version>
  </dependency>


</dependencies>

Here is my log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" >
  <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.hibernate" level="all"/>

  </Loggers>
</Configuration>

i've also added System.setProperty("org.jboss.logging.provider", "log4j2") in my main method as specified by http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html but no effect. Any pointers?

Thanks

sha
  • 614
  • 6
  • 16
  • 1
    I finally found out what's wrong. jboss logging for log4j2 is broken!!!! Log4j2 support in jboss.logging was added only in 3.2.0.Beta1 by means of `Log4j2Logger`. But this [logging call](http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.logging/jboss-logging/3.2.0.Beta1/org/jboss/logging/Log4j2Logger.java?av=f#68) it makes is completely broken! There is no `log` method in Log4j2 which accepts null as first parameter. Am I the first guy to notice this???? How can the jboss team make such a blunder? – sha Sep 30 '14 at 07:56

1 Answers1

4

This bug report says that Log4j2 logging bridge is broken. it throws an NPE! Did anyone test it at all before releasing? I'm planning to take a detour through SLF4j

sha
  • 614
  • 6
  • 16