Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log sql to LOG4J Appender

 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • 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
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic