2011-11-21 35 views
0

我在GlassFish 3.1.1上部署了應用程序。我使用Eclipselink作爲JPA提供程序。是否有可能使glassfish/eclipselink將sql查詢中綁定變量的值記錄到文件中?是否有可能使glassfish3/eclipselink將變量值綁定到日誌文件中?

目前,我有結果

[#|2011-11-21T18:49:39.807+0600|FINE|glassfish3.1.1|org.eclipse.persistence.session.file:/opt/glassfish3/glassfish/domains/domain1/applications/dof-web-1.0/WEB-INF/classes/_mainPU.sql|_ThreadID=20;_ThreadName=Thread-2;ClassName=null;MethodName=null;|SELECT ID, ABIS_BANK_ID, ADDRESS, IS_AGR_EXIST, AUX_VALUE, BIK, CDATE, COUNTRY, CUSER, ENG_VALUE, IIN, KAZ_VALUE, KPP, RUS_VALUE, SWIFT, UDATE, UUSER FROM SCHEMANAME.BANK WHERE (IS_AGR_EXIST = ?) ORDER BY RUS_VALUE ASC 
    bind => [1 parameter bound]|#] 

但我得變量的值。

logging.properties內容:

javax.enterprise.system.tools.admin.level=INFO 
handlers=java.util.logging.ConsoleHandler 
java.util.logging.ConsoleHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter 
com.sun.enterprise.server.logging.GFFileHandler.logFormatDateFormat=yyyy-MM-dd'T'HH\:mm\:ss.SSSZ 
javax.enterprise.system.ssl.security.level=INFO 
org.apache.jasper.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.flushFrequency=1 
org.eclipse.persistence.session.level=FINER 
javax.enterprise.system.tools.backup.level=INFO 
javax.enterprise.resource.corba.level=INFO 
javax.enterprise.resource.webcontainer.jsf.resource.level=INFO 
javax.enterprise.system.core.classloading.level=INFO 
javax.enterprise.resource.jta.level=INFO 
java.util.logging.ConsoleHandler.level=FINEST 
com.sun.enterprise.server.logging.GFFileHandler.file=${com.sun.aas.instanceRoot}/logs/server.log 
javax.enterprise.system.webservices.saaj.level=INFO 
java.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter 
javax.enterprise.system.tools.deployment.level=INFO 
javax.enterprise.system.container.ejb.level=INFO 
javax.enterprise.system.core.transaction.level=INFO 
org.apache.catalina.level=INFO 
javax.enterprise.resource.webcontainer.jsf.lifecycle.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes=0 
javax.enterprise.resource.webcontainer.jsf.config.level=INFO 
javax.enterprise.system.container.ejb.mdb.level=INFO 
javax.enterprise.resource.webcontainer.jsf.timing.level=INFO 
javax.enterprise.system.core.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange=false 
org.apache.coyote.level=INFO 
ShoalLogger.level=CONFIG 
javax.level=INFO 
javax.enterprise.resource.webcontainer.jsf.taglib.level=INFO 
java.util.logging.FileHandler.limit=50000 
com.sun.enterprise.server.logging.GFFileHandler.logtoConsole=false 
javax.enterprise.resource.javamail.level=INFO 
javax.enterprise.system.webservices.rpc.level=INFO 
javax.enterprise.system.container.web.level=INFO 
javax.enterprise.system.util.level=INFO 
javax.enterprise.resource.resourceadapter.level=INFO 
javax.enterprise.resource.webcontainer.jsf.facelets.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.level=FINEST 
javax.org.glassfish.persistence.level=INFO 
javax.enterprise.resource.webcontainer.jsf.context.level=INFO 
javax.enterprise.resource.webcontainer.jsf.application.level=INFO 
javax.enterprise.resource.jms.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=2000000 
javax.enterprise.system.core.config.level=INFO 
org.jvnet.hk2.osgiadapter.level=INFO 
javax.enterprise.system.level=INFO 
javax.enterprise.system.core.security.level=INFO 
java.util.logging.FileHandler.pattern=%h/java%u.log 
javax.enterprise.system.container.cmp.level=INFO 
com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging=false 
javax.enterprise.resource.sqltrace.level=FINE 
javax.enterprise.resource.webcontainer.jsf.renderkit.level=INFO 
javax.enterprise.system.webservices.registry.level=INFO 
javax.enterprise.system.core.selfmanagement.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter 
.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles=0 
log4j.logger.org.hibernate.validator.util.Version=warn 
java.util.logging.FileHandler.count=1 
javax.enterprise.resource.webcontainer.jsf.managedbean.level=INFO 
org.glassfish.admingui.level=INFO 
javax.enterprise.resource.jdo.level=INFO 
javax.enterprise.system.core.naming.level=INFO 
com.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours=0 

的EclipseLink版本

[#|2011-11-21T18:49:31.333+0600|INFO|glassfish3.1.1|org.eclipse.persistence.session.file:/opt/glassfish3/glassfish/domains/domain1/applications/dof-web-1.0/WEB-INF/classes/_mainPU|_ThreadID=18;_ThreadName=Thread-2;|EclipseLink, version: Eclipse Persistence Services - 2.3.0.v20110604-r9504|#] 

回答

1

標題顯示「Toplink」,但您的日誌顯示「Eclipselink」。請糾正這一點。

您是否嘗試添加屬性persistence.xml,爲Eclipse wiki advises

<property name="eclipselink.logging.parameters" value="true"/> 

也許它會在logging.properties工作呢?

1

您可以設置此通過,

"eclipselink.logging.parameters"="true" 
persistence.xml

事實上,默認情況下,對於日誌級別< CONFIG應該是true,但Glassfish對Java日誌記錄的使用似乎令人困惑。請在EclipseLink上記錄一個錯誤,在檢查默認參數記錄時應使用正確的記錄器級別。

相關問題