狂野的无人档案库zh en logback-spring de mi war

时间:2019-07-26 18:44:19

标签: java wildfly spring-logback

Desarrolléun war que tiene un archivo logback-spring.xml,cual funciona bien cuando lo corro como Spring Boot App,名称为logFile.log和su contenido es Correcto,al deployarlo en wildfly 12 el server.log contiene Lo que requiero,我的档案管理档案File.log档案。需要输入文件logFile.log

在WEB-INF /中,您可以在市长上进行各种变种,也可以在Tengo上进行清晰的显示,请在WEB-INF /上进行操作,以确保我的生存。登录到WEB-INF / lib中的agregue和aun no me pinta en el archivo logFile.log

在src / main / resources中创建了logback-spring

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
   <appender name = "CONSOLE" class = "ch.qos.logback.core.ConsoleAppender">
      <encoder>
         <pattern>[%d{yyyy-MM-dd'T'HH:mm:ss.sss'Z'}] [%C] [%t] [%L] [%-5p] %m%n</pattern>
      </encoder>
   </appender>

   <springProfile  name = "pruebas" > 
    <appender name = "FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>/usr/logs/Nom/pruebas/logFile.log</File>
      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- Rollover diario -->                       <fileNamePattern>/usr/logs/Nom/pruebas/logFile.%d{yyyy-MM-dd}.log</fileNamePattern>

      </rollingPolicy>
      <encoder>
         <pattern>[%d{yyyy-MM-dd'T'HH:mm:ss.sss'Z'}] [%C] [%t] [%L] [%-5p] %m%n</pattern>
      </encoder>
   </appender>      
  </springProfile>

    <springProfile  name = "produccion" > 
        <appender name = "FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
          <File>/usr/logs/Nom/produccion/logFile.log</File>
           <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <!-- Rollover diario -->
                <fileNamePattern>/usr/logs/Nom/produccion/logFile.%d{yyyy-MM-dd}.log</fileNamePattern>

          </rollingPolicy>
          <encoder>
             <pattern>[%d{yyyy-MM-dd'T'HH:mm:ss.sss'Z'}] [%C] [%t] [%L] [%-5p] %m%n</pattern>
          </encoder>
       </appender>
    </springProfile>


    <logger name="org.springframework" level="INFO"/>
    <logger name="org.hibernate.SQL" level="DEBUG" />

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

este es mi jboss-deployment-structure.xml

<?xml version="1.0" encoding="UTF-8"?>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
        <exclusions>
            <module name="org.apache.log4j" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

esto es como estoy pintando los log

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOGGER =  
LoggerFactory.getLogger(SelloDao.class);
LOGGER.info("termino de crear cabeceras, tiempo: "+cabeceras);

在server.log上存储所有文件,并在logFile.log上存储

2019-07-26 10:30:50,954 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
2019-07-26 10:30:50,954 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 12.0.0.Final (WildFly Core 4.0.0.Final) started in 19304ms - Started 719 of 912 services (326 services are lazy, passive or on-demand)
2019-07-26 10:34:30,326 INFO  [io.undertow.servlet] (default task-1) Initializing Spring FrameworkServlet 'dispatcherServlet'
2019-07-26 10:34:30,370 INFO  [org.springframework.web.servlet.DispatcherServlet] (default task-1) FrameworkServlet 'dispatcherServlet': initialization started
2019-07-26 10:34:30,383 INFO  [org.springframework.web.servlet.DispatcherServlet] (default task-1) FrameworkServlet 'dispatcherServlet': initialization completed in 13 ms
2019-07-26 10:34:30,384 INFO  [stdout] (default task-1) Filtering on...........................................................
2019-07-26 10:34:30,393 WARN  [com.myapp.Config.JwtAuthenticationFilter] (default task-1) couldn't find prefix string, will ignore the header
2019-07-26 10:34:30,625 INFO  [stdout] (default task-1) vfs:/home/xxx/programas/wildfly12/standalone/deployments/myapp-1.war/WEB-INF/classes
2019-07-26 10:34:32,006 DEBUG [org.hibernate.SQL] (default task-1) 
    select
        usuario0_.id as id1_9_,
        usuario0_.activo as activo6_9_,
        usuario0_.cliente as cliente2_9_,
        usuario0_.eliminado as eliminad7_9_,
        usuario0_.email as email8_9_,
        usuario0_.fechamodificacion as fechamod9_9_,
        usuario0_.fecharegistro as fechare10_9_,
        usuario0_.flag as flag11_9_,
        usuario0_.idadmin as idadmin12_9_,
        usuario0_.password as passwor13_9_,
        usuario0_.rol as rol3_9_,
        usuario0_.tema as tema14_9_,
        usuario0_.timbrador as timbrado4_9_,
        usuario0_.username as username5_9_ 
    from
        users usuario0_ 
    where
        usuario0_.username=?
2019-07-26 10:34:32,146 DEBUG [org.hibernate.SQL] (default task-1) 
    select
        rol0_.id as id1_8_0_,
        rol0_.nombre as nombre2_8_0_ 
    from
        roles rol0_ 
    where
        rol0_.id=?

aplication.properties

#profiles
# ==============================================================
spring.profiles.active=pruebas
#spring.profiles.active=produccion                              
# ==============================================================

不使用任何东西的最终定罪,对决log4j ni slf4j

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
         <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency> 
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
              </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>

      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <scope>provided</scope>
    </dependency> 

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.6.0</version>
        </dependency>

        <!-- MYSQL -->
         <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency> 

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>

<!--  pdfs-->
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>2.0.12</version>
        </dependency>

    <!-- excel -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
        </dependency> 


    <!--  reportes -->
     <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>5.6.1</version>
    </dependency>
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports-fonts</artifactId>
        <version>5.6.1</version>
    </dependency>

     <dependency>
      <groupId>xalan</groupId>
      <artifactId>xalan</artifactId>
      <version>2.7.1</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
    </dependencies>

德·马诺·莱·阿德莱兹科

0 个答案:

没有答案