不要在我的应用程序日志中记录kundera日志

时间:2015-09-15 02:51:57

标签: xml persistence slf4j logback kundera

我想在我的自定义日志文件中禁用Kundera的日志,基本上,我根本不想查看Kundera的日志。 Kundera的PersistenceProperties接口没有任何常量来禁用日志记录。

我有这样的持久性xml。

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="rdb">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.rakuten.points.persistence.entities.Geography</class>
    <class>com.rakuten.points.persistence.entities.GrantPointSummary</class>
    <class>com.rakuten.points.persistence.entities.MemberPointSummary</class>
    <class>com.rakuten.points.persistence.entities.PointDate</class>
    <class>com.rakuten.points.persistence.entities.PointValue</class>
    <class>com.rakuten.points.persistence.entities.Reason</class>
    <class>com.rakuten.points.persistence.entities.Redemption</class>
    <class>com.rakuten.points.persistence.entities.Service</class>
    <class>com.rakuten.points.persistence.entities.Settlement</class>
    <class>com.rakuten.points.persistence.entities.State</class>
    <properties>
        <property name="kundera.nodes" value="localhost" />
        <property name="kundera.port" value="9160" />
        <property name="kundera.keyspace" value="LS" />
        <property name="kundera.dialect" value="cassandra" />
        <property name="kundera.show.query" value="false" />
        <property name="kundera.client.lookup.class"
            value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
        <property name="kundera.ddl.auto.prepare" value="update" />
    </properties>
</persistence-unit>

我的logback.xml是这样的:

<configuration>
<property resource="resource.properties" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOG_HOME}/RPoints.log</file>
<encoder>
   <pattern>%date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line%msg%n</pattern>
 </encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
</root>
</configuration>

顺便说一句,我知道解决这个问题,就是更改logback xml,如下所示

<configuration>
     <property resource="resource.properties" />
     <logger name="<My classes>" level="DEBUG" />
     <appender name="FILE" class="ch.qos.logback.core.FileAppender">
     <file>${LOG_HOME}/RPoints.log</file>
     <encoder>
         <pattern>%date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line
            %msg%n</pattern>
    </encoder>
</appender>

<root level="ERROR">
    <appender-ref ref="FILE" />
</root>
</configuration>

对我来说,上面是一种解决方法,而不是一个实际的解决方案。

我在自定义日志文件中获取以下日志,我想避免它们。请告诉我怎么做:

15:23:28.927 [http-apr-8080-exec-6] INFO  c.i.k.p.EntityManagerFactoryImpl#130 Loading Core
15:23:28.930 [http-apr-8080-exec-6] INFO  c.i.k.l.CoreLoader#41 Loading Kundera Core Metdata ...
15:23:28.933 [http-apr-8080-exec-6] INFO  c.i.k.p.EntityManagerFactoryImpl#654 Loading Persistence Unit MetaData For Persistence Unit(s) ruleengine.
15:23:28.937 [http-apr-8080-exec-6] INFO  c.i.k.c.PersistenceUnitConfiguration#77 Loading Metadata from persistence.xml ...
15:23:29.095 [http-apr-8080-exec-6] INFO  c.i.k.c.PersistenceUnitConfiguration#94 Finishing persistence unit metadata configuration ...
15:23:29.104 [http-apr-8080-exec-6] DEBUG c.i.k.c.MetamodelConfiguration#98 Loading Entity Metadata...

0 个答案:

没有答案