Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Logging sql with logback(Logging sql with logback)
Logging sql with logback [message #718154] Tue, 23 August 2011 12:37 Go to next message
klind Mising name is currently offline klind Mising nameFriend
Messages: 5
Registered: August 2011
Junior Member
Weblogic 10.3.0.0
Eclipselink 2.1.0
logback 0.9.21
slf4j 1.6.0

I would like to log the jpa sql using the logback configuration.
And be able to change the eclipselink log level on the fly.

Anyone knows how to do that ???
Re: Logging sql with logback [message #720498 is a reply to message #718154] Tue, 30 August 2011 17:58 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can implement your own logger to integrate with a third party logging service.

See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomLogger

http://wiki.eclipse.org/EclipseLink/Examples/Foundation/Logging


James : Wiki : Book : Blog : Twitter
(no subject) [message #720499 is a reply to message #718154] Tue, 30 August 2011 17:58 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
You can implement your own logger to integrate with a third party logging service.

See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomLogger

http://wiki.eclipse.org/EclipseLink/Examples/Foundation/Logging
--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Logging sql with logback [message #890115 is a reply to message #718154] Thu, 21 June 2012 07:49 Go to previous message
Tom Wald is currently offline Tom WaldFriend
Messages: 1
Registered: June 2012
Junior Member
A nice developer (Miguel Angel Sosvilla Luis) has written a class to do this. I can't post links as I'm new but search for

gist: 1325764

And you'll find it on github.

And configure it something like this in your persistence.xml

<properties>
	<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
	<property name="javax.persistence.jdbc.url"  value="jdbc:mysql://localhost:3306/dbname" />
	<property name="javax.persistence.jdbc.user" value="root" />
	<property name="javax.persistence.jdbc.password" value="" />
	<property name="eclipselink.target-database" value="MySQL"/>
	<property name="eclipselink.logging.level" value="FINE"/>
	<property name="eclipselink.logging.parameters" value="true"/>
	<property name="eclipselink.logging.timestamp" value="false"/>
	<property name="eclipselink.logging.logger" value="yourpackage.Slf4jSessionLogger"/>
</properties>
Previous Topic:fixed timestamp for start/end values for historical data
Next Topic:exclude-unlisted-classes=false in Equinox OSGI
Goto Forum:
  


Current Time: Thu Apr 25 00:32:19 GMT 2024

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top