0

I have two web application, both run ok on my own web server, but when I publish this in another server, this server is printing twice the same log, but on my server the applications are printing everything ok. I created a specific logger for my application, the category is bo.com.tucomilona so the logs duplicated are only for this category, other logs are printing ok in the server.log.

The configuration of the standalone.xml is

<subsystem xmlns="urn:jboss:domain:logging:3.0">
        <console-handler name="CONSOLE">
            <level name="DEBUG"/>
            <formatter>
               <named-formatter name="COLOR-PATTERN"/>
            </formatter>
        </console-handler>
        <periodic-rotating-file-handler name="FILE" autoflush="true">
            <level name="DEBUG"/>
            <formatter>
                <named-formatter name="COLOR-PATTERN"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="server.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="true"/>
        </periodic-rotating-file-handler>
        <logger category="com.arjuna">
            <level name="WARN"/>
        </logger>
        <logger category="org.apache.tomcat.util.modeler">
            <level name="WARN"/>
        </logger>
        <logger category="org.jboss.as.config">
            <level name="INFO"/>
        </logger>
        <logger category="sun.rmi">
            <level name="WARN"/>
        </logger>
        <logger category="jacorb">
            <level name="WARN"/>
        </logger>
        <logger category="jacorb.config">
            <level name="ERROR"/>
        </logger>
        <logger category="bo.com.tucomilona">
            <level name="DEBUG"/>
            <handlers>
                <handler name="FILE"/>
            </handlers>
        </logger>
        <root-logger>
            <level name="INFO"/>
            <handlers>
                <handler name="CONSOLE" />
                <handler name="FILE"/>
            </handlers>
        </root-logger>
        <formatter name="PATTERN">
            <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
        </formatter>
        <formatter name="COLOR-PATTERN">
            <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
        </formatter>
    </subsystem>

These are the duplicated logs:

23:36:23,584 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "tucomilona-frontend.war" (runtime-name : "tucomilona-frontend.war")
23:36:23,584 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "tucomilona-rest.war" (runtime-name : "tucomilona-rest.war")
23:36:23,584 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "mysql-connector-java-5.1.6-bin.jar" (runtime-name : "mysql-connector-java-5.1.6-bin.jar")
23:36:23,844 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://[0:0:0:0:0:0:0:0]:9990/management
23:36:23,844 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://[0:0:0:0:0:0:0:0]:9990
23:36:23,845 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 44618ms - Started 783 of 982 services (254 services are lazy, passive or on-demand)
23:36:42,821 INFO  [bo.com.tucomilona.rest.endpoint.RestaurantRestEndPoint] (default task-1) Cargado de la pantalla principal.
23:36:42,821 INFO  [bo.com.tucomilona.rest.endpoint.RestaurantRestEndPoint] (default task-1) Cargado de la pantalla principal.
23:36:42,823 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Postconstruct - CacheService
23:36:42,823 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Postconstruct - CacheService
23:36:43,001 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicianlizando cacheo de datos de los restaurantes, cantidad de restaurantes: 101
23:36:43,001 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicianlizando cacheo de datos de los restaurantes, cantidad de restaurantes: 101
23:36:45,011 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando el cacheo de categorias de restaurantes
23:36:45,011 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando el cacheo de categorias de restaurantes
23:36:45,014 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando el cacheo de categorias de productos por restaurant, cantidad de restaurantes habilitados: 101
23:36:45,014 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando el cacheo de categorias de productos por restaurant, cantidad de restaurantes habilitados: 101
23:36:46,607 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando cacheo de productos habilitados, cantidad: 3286
23:36:46,607 DEBUG [bo.com.tucomilona.service.cache.CacheService] (default task-1) Inicializando cacheo de productos habilitados, cantidad: 3286

As you can see, the logs inside the namespace bo.com.tucomilona are duplicated, but the other logs aren't.

MiltonCh
  • 11
  • 2

1 Answers1

2

If you only want those logs to go to the FILE handler then you need to set the use-parent-handlers to false. In CLI the command would look like:

/subsystem=logging/logger=bo.com.tucomilona:write-attribute(name=use-parent-handlers, value=false)

If you want those log messages to go to both the FILE and CONSOLE handlers then you can just remove the FILE handler from your logger.

/subsystem=logging/logger=bo.com.tucomilona:remove-handler(name=FILE)
James R. Perkins
  • 16,800
  • 44
  • 60