Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure WildFly 10 logging subsystem from management console for an application?

Tags:

I want to use the logging subsystem for the Wildfly server for my application. With the help of some blogs online, i added a logging profile for my application in standalone.xml.

        <logging-profiles>
            <logging-profile name="myapp">
                <size-rotating-file-handler name="SIZE" autoflush="true">
                    <level name="ALL"/>
                    <file relative-to="jboss.server.log.dir" path="myapp.log"/>
                    <append value="true"/>
                </size-rotating-file-handler>
                <logger category="com.myapp.logs" use-parent-handlers="false">
                    <level name="ALL"/>
                    <handlers>
                        <handler name="SIZE"/>
                    </handlers>
                </logger>
                <root-logger>
                    <level name="INFO"/>
                    <handlers>
                        <handler name="SIZE"/>
                    </handlers>
                </root-logger>
            </logging-profile>
        </logging-profiles>

I also added the logger profile in Manifest.mf

Manifest-Version: 1.0
Class-Path:  
Logging-Profile: myapp

Now the application logging is working fine, but i would like to know if this can be configured from the management console itself. I tried many times, but failed. And this logging profile is nowhere seen in management console. Am i doing anything wrong here?

Note: I want to keep the application logs separate from server logs.

like image 258
Vishnu P N Avatar asked Sep 01 '16 12:09

Vishnu P N


People also ask

What does WildFly use for logging?

By default WildFly uses a periodic log handler and will create a log for every calendar day. This is different than WebSphere or Jboss, and may not be the desired format for many customers. Luckily WildFly has highly customizable logging. Open the WildFly Admin Console (http://<host>:9990/console by default).

What is subsystem in WildFly?

Overview. The EE subsystem provides common functionality in the Java EE platform, such as the EE Concurrency Utilities (JSR 236) and @Resource injection. The subsystem is also responsible for managing the lifecycle of Java EE application's deployments, that is, . ear files.


1 Answers

You're right I don't see it on the web console either. You can however use CLI to configure a logging profile easily enough. Below are the CLI commands you can use the create the generated XML above.

/subsystem=logging/logging-profile=myapp:add
/subsystem=logging/logging-profile=myapp/size-rotating-file-handler=SIZE:add(autoflush=true, level=ALL, append=true, file={relative-to=jboss.server.log.dir, path=myapp.log})
/subsystem=logging/logging-profile=myapp/logger=com.myapp.logs:add(use-parent-handlers=false, level=ALL, handlers=[SIZE])
/subsystem=logging/logging-profile=myapp/root-logger=ROOT:add(level=INFO, handlers=[SIZE])

With CLI you can run script files too.

$JBOSS_HOME/bin/jboss-cli.sh -c --file=configure-logging.cli
like image 120
James R. Perkins Avatar answered Sep 23 '22 16:09

James R. Perkins