-3

伙计们,我正在使用带有 log4j 和 slf4 的 hibernate 3.5。它正在工作、记录和绑定参数值。所以我更新了4.1.1版本的hibernate,之后log4不记录任何关于hibernate的信息(并且不显示SQL参数值)。我知道新版本使用 jboss 日志,但我尝试删除但没有工作。我正在使用 GlassFish 3.1.1.2(build5)。在我的库中,我有:

-commons-logging
-slf4j-log4j
-log4j(1.2.17)
-slf4j-api(1.7.2)

按照我的 log4j.properties 和 hibernate.cfg

休眠.cfg

<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>

log4.properties

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=D:\\teste.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Root logger option
log4j.rootLogger=INFO, file, stdout

# Log everything. Good for troubleshooting
log4j.logger.org.hibernate=INFO

log4j.logger.org.hibernate.type=ALL
log4j.logger.org.hibernate.jdbc=trace

所以,它适用于其他事情,你可以看到我的 teste.log :

13:52:36,692  INFO AbstractTilesApplicationContextFactory:76 - Initializing Tiles2     application context. . .
13:52:36,707  WARN ChainedTilesApplicationContextFactory:117 - Cannot find    TilesContextFactory class   org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
13:52:36,707  INFO AbstractTilesApplicationContextFactory:95 - Finished initializing Tiles2 application context.
13:52:36,708  WARN ChainedTilesApplicationContextFactory:117 - Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
13:52:36,770  WARN TilesContainerFactory:365 - DEPRECATION WARNING! You are using parameter-based initialization, that is no longer supported! Please see docs:  http://tiles.apache.org/framework/tutorial/configuration.html
13:52:36,771  INFO TilesContainerFactory:372 - Initializing Tiles2 container. . .
13:52:36,774  WARN ChainedTilesApplicationContextFactory:117 - Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
13:52:36,780  INFO ChainedTilesRequestContextFactory:105 - Cannot find TilesRequestContextFactory class org.apache.tiles.portlet.context.PortletTilesRequestContextFactory, skipping support for the managed platform
13:52:36,836  WARN BaseLocaleUrlDefinitionDAO:209 - Unable to find configured definition '/WEB-INF/tiles.xml'
13:52:36,907  INFO TilesContainerFactory:382 - Tiles2 container initialized
13:52:36,909  INFO TilesAccess:113 - Publishing TilesContext for context: org.apache.tiles.servlet.context.ServletTilesApplicationContext

但是,休眠显示服务器标准输出中的信息如下。我不知道休眠使用什么来显示它,如果我删除 jboss 日志,它会继续显示

Informações: Hibernate: 
select
    this_.cobs_id as cobs1_5_0_,
    this_.cobs_attributes as cobs2_5_0_,
    this_.cobs_description as cobs3_5_0_,
    this_.cobs_name as cobs4_5_0_,
    this_.cobs_position as cobs5_5_0_,
    this_.cobs_sequence as cobs6_5_0_,
    this_.cobs_status as cobs7_5_0_,
    this_.cobs_template as cobs8_5_0_,
    this_.cobs_cosi_id as cobs9_5_0_ 
from
    core.core_blocks this_ 
where
    this_.cobs_cosi_id=? 
    and not exists (
        select
            1 
        from
            core.core_groups_blocks 
        where
            this_.cobs_id=cogb_cobs_id
    ) 
order by
    this_.cobs_sequence asc
Informações: Hibernate: 

检查我的服务器标准输出我发现了这个:

Informações: HHH000046: Connection properties: {user=root, password=****}
Informações: HHH000006: Autocommit mode: false

可能休眠正在使用其他日志来注册信息,但我找不到它

4

1 回答 1

0

显然问题是由 GlassFish 3.1.2.2 引起的,我安装了 glassfish 3.1.2 并解决了问题

于 2012-10-18T16:51:06.617 回答