xml - Printing all the entities(domain) in log file -


i using log4j2.xml web application , working fine. problem is, printing domain information also. using hibernate+spring.since domain contains user class printing password in log file.. log4j.xml below..

<?xml version="1.0" encoding="utf-8"?> <configuration status="trace">     <appenders>              <rollingrandomaccessfile name="onboarding_log" filename="c:/jetty-distribution-9.0.6.v20130930/logs/onboarding.log" filepattern="c:/jetty-distribution-9.0.6.v20130930/logs/onboarding.log.%i" append="true" immediateflush="true">                     <patternlayout>                             <pattern>%d{iso8601} %-5p [%t]: [%c{1}] %m%n-%x{elapsedtime}-%x{bytesize}-%x{uniqueid}-%x{httpmethod}-%x{url}-</pattern>                     </patternlayout>                     <policies>                             <sizebasedtriggeringpolicy size="250 mb"/>                     </policies>                     <defaultrolloverstrategy max="10"/>             </rollingrandomaccessfile>     </appenders>     <loggers>              <root level="debug">                     <appender-ref ref="onboarding_log"/>             </root>     </loggers> 

and session-factory.xml as...

<bean id="datasource" class="org.springframework.jndi.jndiobjectfactorybean">     <property name="jndiname">         <value>java:comp/env/jdbc/onboarding</value>     </property> </bean>  <bean id="sessionfactory"     class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean">      <property name="datasource" ref="datasource" />     <property name="hibernateproperties">         <props>             <prop key="hibernate.dialect">org.hibernate.dialect.mysqldialect</prop>         </props>     </property>     <property name="packagestoscan">         <list>             <value>biz.neustar.onboarding.domain</value>         </list>     </property>  </bean>  <bean id="transactionmanager"     class="org.springframework.orm.hibernate3.hibernatetransactionmanager">     <property name="sessionfactory" ref="sessionfactory" /> </bean> 

and message log file is....

 [printer] listing entities:      ------2014-03-06 13:35:59,178 debug [qtp19318917-21:http://0:0:0:0:0:0:0:1:8080/onboarding/index.do]:             [printer] biz.neustar.onboarding.domain.user{lastname=tp, updateddate=2014-02-28 20:12:02,   companyname=turningpoint, password=admin, useroid=1, phoneno=1.234567890, islogged=y, organizationstaginglist=<uninitialized>, email=admin@tpgsi.com, userstatus=biz.neustar.onboarding.domain.userstatus#1, username=admin, firstname=admin, createddate=2007-05-06 00:00:00, useraccess=biz.neustar.onboarding.domain.useraccess#1}       ------2014-03-06 13:35:59,178 debug [qtp19318917-21:http://0:0:0:0:0:0:0:1:8080/onboarding/index.do]: [printer] biz.neustar.onboarding.domain.useraccess{users=<uninitialized>, accessid=1, accesstype=administrator}      ------2014-03-06 13:35:59,178 debug [qtp19318917-21:http://0:0:0:0:0:0:0:1:8080/onboarding/index.do]: [printer] biz.neustar.onboarding.domain.userstatus{statusid=1, users=<uninitialized>, statustype=active} 

the problem hibernate internally uses log4j log message. got know seeing logs contains printer , final class defined in hibernate made changes in log4j.xml. , should added before root level...i hope helpful others , other comments highly appreciated..thanks

 <loggers>     <logger name="org.hibernate.pretty">             <level value="off" />     </logger>      <logger name="org.hibernate.sql">         <level value="off"/>     </logger>      <logger name="org.hibernate">         <level value="off"/>     </logger>      <logger name="org.hibernate.secure">         <level value="off"/>     </logger>      <logger name="org.hibernate.hql.ast.ast">         <level value="off"/>     </logger>      <logger name="org.hibernate.jdbc">         <level value="off"/>     </logger>      <logger name="org.hibernate.transaction">         <level value="off"/>     </logger>      <logger name="org.hibernate.tool.hbm2ddl">         <level value="off"/>     </logger>      <logger name="org.hibernate.type">               <level value="off"/>     </logger>        

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -