Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Log sql to LOG4J Appender

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to output the sql which hibernate generates in my application to my log4j appender as follows:

1. I am not seeing any output in test.log from hibernate
2. In system.out log I am not seeing the actual parameter value:

I am using Spring. My appContext.xml is as follows
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to make sure that either your file is named log4j.ml and is present at the root of your classpath with log4j jar in the classpath as well.
Or if you name it differently you need to load the file with a configurer caling your specific name
 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ntumba lobo wrote:you need to make sure that either your file is named log4j.ml and is present at the root of your classpath with log4j jar in the classpath as well.
Or if you name it differently you need to load the file with a configurer caling your specific name



My application is able to output to the test.log file. Its just the hibernate output which is not being displayed in test.log
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then try specifying the log4j appender in both your hibernate loggers


 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
already tried that - no luck. according to log4j docs loggers inherit from the root so dont need to specify appender hence the reason why i removed it
 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any ideas??? i am using spring 2.5.6, log4j 1.2.16, hibernate 3.2.6ga and Websphere App Server 7
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic