Bug 1283194

Summary: logViewer cannot show the log file generated by custom handler
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ranjith Pulluru <rpulluru>
Component: LoggingAssignee: Panagiotis Sotiropoulos <psotirop>
Status: CLOSED NOTABUG QA Contact: Nikoleta Hlavickova <nziakova>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.4CC: bbaranow, brian.stansberry, cdewolf, harshada, jperkins, psotirop
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 08:43:47 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:

Description Ranjith Pulluru 2015-11-18 12:35:08 UTC
Description of problem:
=======================
- logViewer cannot show the log file generated by custom 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 custom handler with `periodic-size-rotating-file-handler` in standalone.xml as below.
--------
   <custom-handler name="PERIODIC-SIZE" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">
       <level name="INFO"/>
       <formatter>
          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
       </formatter>
       <properties>
       <property name="append" value="true"/>
       <property name="level" value="INFO"/>
       <property name="fileName" value="${jboss.server.log.dir}/CustomHandler.log"/>
       <property name="rotateSize" value="50000000"/>
       <property name="suffix" value=".yyyy-MM-dd"/>
       <property name="autoFlush" value="true"/>
   </properties>
--------
3) Add the custom-handler name(PERIODIC-SIZE) in root-logger.
4) Then start the JBoss server.
5) Open the admin console
    AdminConsole -> Runtime tab -> LogViewer

Actual results:
===============
- Cannot view th CustomHandler log file in admin console.


Expected results:
=================
- CustomHandler log file should be shown.

Additional info:
=================

Comment 1 James Perkins 2015-11-18 20:47:08 UTC
This was done intentionally. The log files can only be read if they're a file-handler, periodic-rotating-file-handler, size-rotating-file-handler or periodic-size-rotating-handler resource. A custom-handler cannot be read via the log viewer.

The relative-to path MUST be jboss.server.log.dir for the resource as well.

That said in 6.4 there is a periodic-size-rotating-file-handler so you don't have to use a custom-handler for it.

The add CLI command for the above:
/subsystem=logging/periodic-size-rotating-file-handler=PERIODIC_SIZE:add(append=true, autoflush=true, level=INFO, named-formatter=PATTERN, rotate-size="500M", suffix=".yyyy-MM-dd", file={relative-to=jboss.server.log.dir, path="CustomHandler.log"})

Then you can read the resources:
/subsystem=logging/log-file=CustomHandler.log:read-resource(include-runtime=true)

Comment 2 Panagiotis Sotiropoulos 2015-11-19 08:43:47 UTC
Closing as NOT A BUG, based on Comment 1.