2015/4/29

useing Log4J2 with Hibernate and slf4J,logger example




<?xml version="1.0" encoding="UTF-8"?>
<configuration xsixmlns="Log4j-config.xsd">
    <Appenders>
        <Console name="CONSOLE" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
        </Console>

        <RollingFile name="RollingFile_Listener" fileName="logs/SocketServerListener.log"
            filePattern="logs/$${date:yyyy-MM}/SockServerListener-%d{MM-dd-yyyy}-%i.log.gz">
            <Filters>
                <ThresholdFilter level="INFO" onMatch="ACCEPT"
                    onMismatch="DENY" />
            </Filters>
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="500 MB" />
            </Policies>
            <DefaultRolloverStrategy max="20" />
        </RollingFile>

        <RollingFile name="RollingFile_TRACE" fileName="logs/SocketServerTRACE.log"
            filePattern="logs/$${date:yyyy-MM}/SockServerTRACE-%d{MM-dd-yyyy}-%i.log.gz">
            <Filters>
                <ThresholdFilter level="INFO" onMatch="DENY"
                    onMismatch="NEUTRAL" />
                <ThresholdFilter level="DEBUG" onMatch="DENY"
                    onMismatch="NEUTRAL" />
                <ThresholdFilter level="TRACE" onMatch="ACCEPT"
                    onMismatch="DENY" />
            </Filters>
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="100 MB" />
            </Policies>
            <DefaultRolloverStrategy max="10" />
        </RollingFile>
        <RollingFile name="RollingFile_DEBUG" fileName="logs/SocketServerDEBUG.log"
            filePattern="logs/$${date:yyyy-MM}/SockServerDEBUG-%d{MM-dd-yyyy}-%i.log.gz">
            <Filters>
                <ThresholdFilter level="INFO" onMatch="DENY"
                    onMismatch="NEUTRAL" />
                <ThresholdFilter level="DEBUG" onMatch="ACCEPT"
                    onMismatch="DENY" />
            </Filters>
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="200 MB" />
            </Policies>
            <DefaultRolloverStrategy max="10" />
        </RollingFile>

        <RollingFile name="RollingFile_INFO" fileName="logs/SocketServer.log"
            filePattern="logs/$${date:yyyy-MM}/SockServer-%d{MM-dd-yyyy}-%i.log.gz">
            <Filters>
                <ThresholdFilter level="INFO" onMatch="ACCEPT"
                    onMismatch="DENY" />
            </Filters>
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="500 MB" />
            </Policies>
            <DefaultRolloverStrategy max="20" />
        </RollingFile>

    </Appenders>
    <Loggers>
        <logger name="org.hibernate.SQL">
            <level value="INFO" />
        </logger>
        <logger name="org.hibernate">
            <level value="INFO" />
        </logger>
        <logger name="SocketServerStatusListener" level="INFO"
            additivity="false">
            <AppenderRef ref="RollingFile_Listener" />
        </logger>
        <Root level="INFO">
            <AppenderRef ref="RollingFile_INFO" />
            <AppenderRef ref="RollingFile_TRACE" />
            <AppenderRef ref="RollingFile_DEBUG" />
            <AppenderRef ref="CONSOLE" />
        </Root>
    </Loggers>
</configuration>
 important:
myCLASSPATH=./JAR/JSON.jar:./JAR/c3p0-0.9.1.jar:./JAR/hibernate41.jar:./JAR/slf4j-api-1.7.6.jar:./JAR/log4j-api-2.1.jar:./JAR/log4j-core-2.1.jar:./JAR/log4j-1.2-api-2.1.jar:./JAR/slf4j-log4j12-1.7.6.jar:./JAR/httpclient-4.4.jar:./JAR/fluent-hc-4.4.jar:./JAR/httpclient-cache-4.4.jar:./JAR/httpclient-win-4.4.jar:./JAR/httpcore-4.4.jar:./JAR/httpmime-4.4.jar:./JAR/jna-4.1.0.jar:./JAR/jna-platform-4.1.0.jar:./JAR/commons-logging-1.2.jar:./JAR/hibernate-entitymanager-4.1.4.Final.jar:./JAR/antlr-2.7.7.jar:./JAR/dom4j-1.6.1.jar:./JAR/hibernate-commons-annotations-4.0.1.Final.jar:./JAR/hibernate-core-4.1.4.Final.jar:./JAR/hibernate-jpa-2.0-api-1.0.1.Final.jar:./JAR/hibernate-validator-4.2.0.Final.jar:./JAR/javassist-3.15.0-GA.jar:./JAR/jboss-logging-3.1.0.GA.jar:./JAR/jboss-transaction-api_1.1_spec-1.0.0.Final.jar:./JAR/hibernate-envers-4.1.4.Final.jar:./JAR/c3p0-0.9.1.jar:./JAR/hibernate-c3p0-4.1.4.Final.jar:./JAR/ehcache-core-2.4.3.jar:./JAR/hibernate-ehcache-4.1.4.Final.jar:./JAR/hibernate-infinispan-4.1.4.Final.jar:./JAR/infinispan-core-5.1.4.FINAL.jar:./JAR/jboss-marshalling-1.3.11.GA.jar:./JAR/jboss-marshalling-river-1.3.11.GA.jar:./JAR/jgroups-3.0.9.Final.jar:./JAR/rhq-pluginAnnotations-3.0.4.jar:./JAR/stax2-api-3.1.1.jar:./JAR/woodstox-core-asl-4.1.1.jar:./JAR/hibernate-proxool-4.1.4.Final.jar:./JAR/proxool-0.8.3.jar:./JAR/mysql-connector-java-5.0.8-bin.jar:./JAR/jboss-logging-3.1.3.GA.jar:./JAR/jboss-logging-annotations-1.2.0.Beta1.jar::./JAR/dom4j-1.6.1_2.jar:./JAR/xml-apis-1.0.b2.jar:./JAR/javassist-3.18.1-GA.jar:./JAR/antlr-2.7.7_2.jar:./JAR/jandex-1.1.0.Final.jar:./JAR/mysql-connector-java-5.0.5.jar:./JAR/log4j-1.2.17.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar

沒有留言:

windows 無法拖動文件

原因:未知 症狀:windows點任何文件,都無法拖動到其他地方  解決方式: 來源: https://answers.microsoft.com/en-us/windows/forum/all/drag-and-drop-stopped-working/b73e4938-ca2...