Wildfly doesn't recognize jboss deployment structure file

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:09:37

问题


I'm trying to configure Wildfly to use per deployment logging and jackson as provider for json on resteasy but looks like the AS doesn't recognize the file "jboss-deployment-structure.xml".

I wanna log the hibernate sql, i already put "<property name="hibernate.show_sql" value="true"/>" in persistence.xml.

And for Jackson, i use the following method:

    @GET
    @Path("/resumodia")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes("*/*")
    @GZIP
    public Response resumoHorariosDoDia() {
        try {
            final ResumoHorariosUsuarioDoDia resumoHorariosDoDia = geradorDeResumoHorarios.getResumoHorariosDoDia(new Date());

            return Response.status(OK).entity(resumoHorariosDoDia).build();
        } catch (Exception e) {
            return Response.status(INTERNAL_SERVER_ERROR).entity("Erro ao processar a requisição: " + e.getMessage()).build();
        }
    }

The method works, but it ignores the json annotation i use on the object i return, like @JsonIgnore

The file is this one:

<jboss-deployment-structure>
    <deployment>
        <exclude-subsystems>
            <subsystem name="logging" />
        </exclude-subsystems>
        <exclusions>
            <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
            <module name="org.jboss.resteasy.resteasy-jettison-provider"/>
        </exclusions>
        <dependencies>
            <module name="org.apache.log4j"/>
            <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

I put the file inside WEB-INF but it keeps using the wildfly logging and ignoring my log4j.xml.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM
        "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://jakarta.apache.org/log4j/
http://jakarta.apache.org/log4j/ ">

    <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %5p [%-20c{1}] %m%n"/>
        </layout>
    </appender>

    <category name="br.com.caelum">
        <priority value="INFO"/>
        <appender-ref ref="stdout"/>
    </category>

    <category name="org.hibernate">
        <priority value="INFO"/>
        <appender-ref ref="stdout"/>
    </category>

    <category name="org.hibernate.SQL">
        <priority value="DEBUG"/>
        <appender-ref ref="stdout"/>
    </category>

    <category name="org.jboss">
        <priority value="INFO"/>
        <appender-ref ref="stdout"/>
    </category>

    <category name="org.razor.cponto">
        <priority value="INFO"/>
        <appender-ref ref="stdout"/>
    </category>

</log4j:configuration>

I'm using VRaptor 4


回答1:


If you simply want to use per deployment logging, simply package your log4j.xml file with your deployment, there should be no need to mess about with deployment descriptors. What I do notice however is that your log4j config is trying to append to stdout rather than to an actual log file that is specific to this specific deployment, so it might well be actually using your new config, but then simply being merged into the main jboss logging due to lack of suitable appender



来源:https://stackoverflow.com/questions/28676830/wildfly-doesnt-recognize-jboss-deployment-structure-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!