Purna
Purna

Reputation: 43

Wildfly Log Viewer has to show log4j logs

I am using WildFly9.0 and able to see the server.log in web console's Log Viewer page. My application has its own log files in the same folder with different names configured using log4j.

My question is how can i see those files also in web console's Log Viewer? How to configure them?

Upvotes: 1

Views: 2119

Answers (2)

Sivaram Kumar
Sivaram Kumar

Reputation: 331

With Wildfly 10 it is possible by adding new file-handlers to standalone.xml for each log files that wanna be listed in log viewers page.

E.g. I have added appenders.log along with server.log to the log viewer console by adding APPENDERS handler as shown below. Also not that each handler requires unique name.

<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="APPENDERS" autoflush="true">
    <formatter>
        <named-formatter name="PATTERN"/>
    </formatter>
    <file relative-to="jboss.server.log.dir" path="appenders.log"/>
    <suffix value=".yyyy-MM-dd"/>
    <append value="true"/>
</periodic-rotating-file-handler>

Upvotes: 0

James R. Perkins
James R. Perkins

Reputation: 17770

The web console uses the log-file resource under the logging subsystem. This only allows the files from the following handlers to be listed; file-handler, periodic-rotating-file-handler, periodic-size-rotating-file-handler and size-rotating-file-handler. Also note that if you use one of these handlers the relative-to attribute must be set to jboss.server.log.dir.

There is no way to register additional files. The main reason for this was to not allow the server to become a raw file server. Plus there are security concerns around just allowing any file on the file system to be read/downloaded.

Upvotes: 0

Related Questions