Hi Rashmi,
  you need to register an appender for every logger defined 
in your log4jproperties file. Logger present are:

# root logger (always present)
rootLogger

# Logger on top of hierarchy of loggers for hibernate package
org.hibernate

### loggger for HQL query parser activity
org.hibernate.hql.ast.AST
 
### loggger for just the SQL
org.hibernate.SQL
 
### loggger for JDBC bind parameters ###
org.hibernate.type
 
### logger for schema export/update ###
org.hibernate.tool.hbm2ddl

In this case (and this is a best practice), logger names are 
equals to packages in hibernate library. These loggers hinherit 
almost everything (appenders, for instance) by default from 
root logger and so they send their output to stdout (console, 
the appender registered for the root logger). If you need to send
output to another appender, you need to specify the appender name(s)
in the definition of every logger (or in the definition of the 
logger on top of hierarchy of their names):


log4j.logger.org.hibernate=debug,file
 
### log HQL query parser activity
log4j.logger.org.hibernate.hql.ast.AST=debug,file
 
### log just the SQL
log4j.logger.org.hibernate.SQL=debug,file
 
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info,file
 
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug,file

Now you registered 'file' appender for your loggers. Note that 
you could write only
log4j.logger.org.hibernate=debug,file

and don't specify appender for other loggers, because they are 
above in the hierarchy in respect with 'org.hibernate' logger:

### log HQL query parser activity
log4j.logger.org.hibernate.hql.ast.AST=debug
 
### log just the SQL
log4j.logger.org.hibernate.SQL=debug
 
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
 
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug



Hope this can help.

Bye!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to