0

I am migrating my application from JBoss 6 AS to Wildfly 8.2.0 AS. I could achieve creating application logs as expected but standalone/log/server.log file is also getting filled with application logs.I am using standalone-full-ha.xml configuration. Could anyone please suggest an option to disable application logs getting filled into server.log.

Below section is taken from standalone-full-ha.xml:

<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN" /> 
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log" /> 
<suffix value=".yyyy-MM-dd" /> 
<append value="true" /> 
</periodic-rotating-file-handler>
sridhar
  • 1,117
  • 5
  • 31
  • 59

2 Answers2

1

You can add an additional custom file handler to the logging subsystem for your application category or categories:

  <subsystem xmlns="urn:jboss:domain:logging:2.0">
    <console-handler name="CONSOLE">
        <level name="INFO"/>
        <formatter>
            <named-formatter name="COLOR-PATTERN"/>
        </formatter>
    </console-handler>
    <periodic-rotating-file-handler name="FILE" autoflush="true">
        <formatter>
            <named-formatter name="PATTERN"/>
        </formatter>
        <file relative-to="jboss.server.log.dir" path="server.log"/>
        <suffix value=".yyyy-MM-dd"/>
        <append value="true"/>
    </periodic-rotating-file-handler>
    <periodic-rotating-file-handler name="MYHANDLER" autoflush="true">
        <formatter>
            <named-formatter name="PATTERN"/>
        </formatter>
        <file relative-to="jboss.server.log.dir" path="application-audit.log"/>
        <suffix value=".yyyy-MM-dd"/>
        <append value="true"/>
    </periodic-rotating-file-handler>
    <logger category="com.mycompany.myapplication">
        <level name="INFO"/>
        <handlers>
            <handler name="MYHANDLER"/>
        </handlers>
    </logger>

See also: How to log application auditing to separate file on Wildfly 8

Community
  • 1
  • 1
sprockets
  • 981
  • 1
  • 6
  • 16
  • Many thanks for the response .. Sprockets. I used the options provided in the link but still I could see application logs are logged in server.log file. JFYI that I have not packed log4j in EAR deployed and instead, added the module deployment "org.apache.log4j" in classpath of the EAR. – sridhar Jul 02 '15 at 06:48
  • I misunderstood your Q, instead you might try to add a custom handler for your logging categories. I updated my answer accordingly. – sprockets Jul 02 '15 at 06:56
  • Many thanks .. Sprockets. I will verify with the updated answer. Just adding.. application logs are generated in a separate file properly. My concern is that logs are getting logged additionally in server.log. – sridhar Jul 02 '15 at 07:02
0

This can be disabled from the admin console. http://localhost:9990/

  1. Within the console goto configurations

  2. Within that choose Subsystems Logging  HandlerPeriodic.

  3. Edit the configuration and set the Log Level as OFF and save. enter image description here

PFB the image for reference.

enter image description here

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43