Discussion:
Hibernate 4.x/JBoss Logging and Log4j2
Stefan Bodewig
2014-10-12 11:05:25 UTC
Permalink
Hi

it took me quite some time to get Hibernate 4.x to log using log4j2.
Part of the problem is that most documentation on Hibernate logging is
based on Hibernate 3.x and Hibernate 4.x now uses JBoss Logging which
changes everything.

I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j) and would like to
document it somewhere. What would you feel is the most appropriate
place to do this? My first choice would have been the Wiki but this
doesn't seem to be the place the project uses for information like
this. Where else? The FAQ, my personal blog, ... ?

Stefan

PS: JBoss Logging's master branch has been supporting log4j2 natively
for three months but hasn't seen any release since then. This means
whatever I write will become obsolete at one point in time.
Stefan Bodewig
2014-10-12 11:07:14 UTC
Permalink
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.

Stefan
Gary Gregory
2014-10-12 12:19:42 UTC
Permalink
I'd never look for it there... how about a new section called "Integration"?
We can have a subsection for Hibernate, Jetty, Cxf, and so on.
Gary
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-***@logging.apache.org
For additional commands, e-mail: log4j-dev-***@logging.apache.org
Ralph Goers
2014-10-12 15:05:07 UTC
Permalink
Put it on the wiki.

Sent from my iPad
Post by Gary Gregory
I'd never look for it there... how about a new section called "Integration"?
We can have a subsection for Hibernate, Jetty, Cxf, and so on.
Gary
-------- Original message --------
From: Stefan Bodewig
Date:10/12/2014 07:07 (GMT-05:00)
To: Log4J Developers List
Subject: Re: Hibernate 4.x/JBoss Logging and Log4j2
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.
Stefan
---------------------------------------------------------------------
Gary Gregory
2014-10-12 15:26:28 UTC
Permalink
Let's make sure the site has an easy to find link to the wiki then.

Gary
Post by Ralph Goers
Put it on the wiki.
Sent from my iPad
Post by Gary Gregory
I'd never look for it there... how about a new section called
"Integration"?
Post by Gary Gregory
We can have a subsection for Hibernate, Jetty, Cxf, and so on.
Gary
-------- Original message --------
From: Stefan Bodewig
Date:10/12/2014 07:07 (GMT-05:00)
To: Log4J Developers List
Subject: Re: Hibernate 4.x/JBoss Logging and Log4j2
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.
Stefan
---------------------------------------------------------------------
---------------------------------------------------------------------
--
E-Mail: ***@gmail.com | ***@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Matt Sicker
2014-10-12 16:09:27 UTC
Permalink
I thought JBoss logging already added log4j2 support a while back?
Post by Gary Gregory
Let's make sure the site has an easy to find link to the wiki then.
Gary
Post by Ralph Goers
Put it on the wiki.
Sent from my iPad
Post by Gary Gregory
I'd never look for it there... how about a new section called
"Integration"?
Post by Gary Gregory
We can have a subsection for Hibernate, Jetty, Cxf, and so on.
Gary
-------- Original message --------
From: Stefan Bodewig
Date:10/12/2014 07:07 (GMT-05:00)
To: Log4J Developers List
Subject: Re: Hibernate 4.x/JBoss Logging and Log4j2
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.
Stefan
---------------------------------------------------------------------
---------------------------------------------------------------------
--
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
--
Matt Sicker <***@gmail.com>
Stefan Bodewig
2014-10-12 17:29:24 UTC
Permalink
Post by Matt Sicker
I thought JBoss logging already added log4j2 support a while back?
But never cut a release after that.

Stefan
Ralph Goers
2014-10-12 16:16:47 UTC
Permalink
It is right on the top nav of the web site - The very first link.

Ralph
Post by Gary Gregory
Let's make sure the site has an easy to find link to the wiki then.
Gary
Put it on the wiki.
Sent from my iPad
Post by Gary Gregory
I'd never look for it there... how about a new section called "Integration"?
We can have a subsection for Hibernate, Jetty, Cxf, and so on.
Gary
-------- Original message --------
From: Stefan Bodewig
Date:10/12/2014 07:07 (GMT-05:00)
To: Log4J Developers List
Subject: Re: Hibernate 4.x/JBoss Logging and Log4j2
Post by Stefan Bodewig
I finallly figured out how to combine the two (in short, use the slf4j
bridge and explicitly tell jboss logging to use slf4j)
log4j2's slf4j binding, of course.
Stefan
---------------------------------------------------------------------
---------------------------------------------------------------------
--
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition
Spring Batch in Action
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Gary Gregory
2014-10-12 18:09:41 UTC
Permalink
Not even in 4.3.6?

Gary
Post by Matt Sicker
I thought JBoss logging already added log4j2 support a while back?
But never cut a release after that.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-***@logging.apache.org
For additional commands, e-mail: log4j-dev-***@logging.apache.org
Matt Sicker
2014-10-12 19:32:43 UTC
Permalink
Makes me wonder if we should emphasise the use of log4j-slf4j-impl. I did
improve that module a bit recently to make LoggerContext selection use the
same algorithm buried in ClassLoaderContextSelector (which was ported to
ReflectionUtil in log4j-api).
Post by Gary Gregory
Not even in 4.3.6?
Gary
-------- Original message --------
From: Stefan Bodewig
Date:10/12/2014 13:29 (GMT-05:00)
To: Log4J Developers List
Subject: Re: Hibernate 4.x/JBoss Logging and Log4j2
Post by Matt Sicker
I thought JBoss logging already added log4j2 support a while back?
But never cut a release after that.
Stefan
---------------------------------------------------------------------
--
Matt Sicker <***@gmail.com>
Stefan Bodewig
2014-10-13 04:05:23 UTC
Permalink
Post by Gary Gregory
Not even in 4.3.6?
"The problem" is not Hibernate but the jboss-logging library it uses.

https://github.com/jboss-logging/jboss-logging

Last "release" has been 3.2.0.Beta1 in February, log4j2 support has been
added in July. Oh, while looking through the commit log once again I
see initial support has been added in 2013, I've been confused by the
fact the same file has been touched on July 17th in 2013 and 2014.
Before I write down anything I'll try to force Hibernate to use a new
jboss-logging.

Stefan
Stefan Bodewig
2014-10-13 12:17:46 UTC
Permalink
Here are combinations of versions, dependencies and system properties
that I have found that worked:

https://wiki.apache.org/logging/Log4j2AndHibernate4

Stefan

Loading...