Bug 1266360

Summary: [GSS](6.4.z) Asynchronous logging doesn't work with periodic-size-rotating-file-handler
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ranjith Pulluru <rpulluru>
Component: LoggingAssignee: Panagiotis Sotiropoulos <psotirop>
Status: CLOSED CURRENTRELEASE QA Contact: Nikoleta Hlavickova <nziakova>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.3CC: bmaxwell, brian.stansberry, cdewolf, jbilek, jperkins, jtruhlar, msochure, ppagolu, psotirop
Target Milestone: CR1   
Target Release: EAP 6.4.11   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1306270 (view as bug list) Environment:
Last Closed: 2017-01-17 13:11:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1306270, 1361648    

Description Ranjith Pulluru 2015-09-25 06:40:04 UTC
Description of problem:
=======================
 - Asynchronous logging doesn't work with periodic-size-rotating-file-handler

Version-Release number of selected component (if applicable):
==============================================================
 - JBoss EAP 6.4.x

Steps to Reproduce:
===================
1) Take a fresh JBoss EAP 6.4.x version.
2) Configure periodic-size-rotating-file-handler.
3) Configure async-handler which uses periodic-size-rotating-file-handler
4) Add the async-handler name in root-logger

Configuration looks as below in standalone.xml file after the above steps:
--------
      <subsystem xmlns="urn:jboss:domain:logging:1.5">
           <async-handler name="ASYNC">
                <level name="ALL"/>
                <queue-length value="3024"/>
                <overflow-action value="discard"/>
                <subhandlers>
                   <handler name="PSRFILE"/>  
                </subhandlers>
            </async-handler>
            <periodic-size-rotating-file-handler name="PSRFILE" autoflush="true">
                <level name="ALL"/>
                <formatter>
                    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t/%X{threadId}) %s%E%n"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="PSRFILE.log"/>
                <rotate-size value="200m"/>
                <max-backup-index value="5"/>
                <suffix value=".yyyy.MM.dd"/>
            </periodic-size-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="DEBUG"/>
            </logger>
            <logger category="sun.rmi">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb.config">
                <level name="ERROR"/>
            </logger>
            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="ASYNC"/>
                </handlers>
            </root-logger>
        </subsystem>
--------

5) Then start the JBoss server.

Actual results:
===============
- PSRFILE contains only startup logging. There is no JBoss server logging in the PSRFILE.

Expected results:
=================
- Along with JBoss server startup logging there should be JBoss server logging in PSRFILE. 

Additional info:
=================
- I can see this issue in JBoss EAP 6.4.x versions.
  
- I tried using `periodic-size-rotating-file-handler` in custom handler then I can see the complete JBoss server logging in PSRFILE.

Comment 1 James Perkins 2015-09-28 17:11:39 UTC
During boot the periodic-size-rotating-file-handler is removed and a new one is added. The async-handler still references the old closed one which has a null writer since it was marked for removal. All that needs to be done is the file handler needs to not be removed during the subsystem add. Here's the WildFly fix https://issues.jboss.org/browse/WFCORE-1018.

Comment 3 Prasanth Pagolu 2016-02-02 11:02:04 UTC
I've experienced issue with periodic-rotating-file-handler too where the logs are not being rotated and eventually the Jboss server ends up with 'too many open files' error.
I am using Jboss EAP 6.3, here is the configuration:

<async-handler name="ASYNC">
                <level name="INFO"/>
                <queue-length value="500"/>
                <overflow-action value="block"/>
                <subhandlers>
                    <handler name="FILE"/>
                </subhandlers>
            </async-handler>
....
....
 <periodic-rotating-file-handler name="FILE" autoflush="true">
                <formatter>
                    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %X{jsessionid} %-5p %X{deviceId} %X{principal} [%c] (%t) %s%E%n"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>
            </periodic-rotating-file-handler>
...
...
 <root-logger>
                <level name="DEBUG"/>
                <handlers>
                    <handler name="ASYNC"/>
                </handlers>
            </root-logger>

Could you please suggest a fix or workaround?

Regards,

Prash

Comment 5 Panagiotis Sotiropoulos 2016-02-11 13:56:51 UTC
Could you try the custom-handler for EAP 6.3 :

           <custom-handler name="PSRFILE"               class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">

                <level name="TRACE"/>

                <formatter>

                    <pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>

                </formatter>

                <properties>

                    <property name="fileName" value="${jboss.server.log.dir}/PSRFILE.log"/>

                    <property name="rotateSize" value="1024"/>

                    <property name="suffix" value=".yyyy-MM-dd"/>

                    <property name="maxBackupIndex" value="5"/>

                    <property name="append" value="true"/>

                    <property name="autoFlush" value="true"/>

                </properties>

            </custom-handler>



            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="PSRFILE"/>
                </handlers>
            </root-logger>

Comment 6 Mike McCune 2016-03-28 23:23:30 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 7 Jiří Bílek 2016-09-27 09:12:58 UTC
Verified with EAP 6.4.11.CP.CR1

Comment 8 Petr Penicka 2017-01-17 13:11:54 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.