Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildfly as service: How to log just once?

Tags:

jboss

wildfly

I'm running wildfly as a service on Linux.

I used the well-written instruction on http://developer-should-know.tumblr.com/post/112230363742/how-to-install-wildfly-as-a-service-on-linux that is based on a script [wildflyhome/bin/init.d/wildfly-init-redhat.sh] contained in the wildfly distribution. This script uses the declaration

JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log"

Problem: This configuration logs twice: Firstly in server.log (in wildflyhome/standalone/log) and secondly in console.log. This wastes storage (and maybe some performance).

Therefore I set

JBOSS_CONSOLE_LOG="wildflyhome/standalone/log/server.log"

But now each log entry is written twice into server.log -:)

Question: How can I configure wildfly such that it logs just once ?

like image 400
user120513 Avatar asked May 11 '16 21:05

user120513


People also ask

Where are WildFly logs stored?

Where CA Identity Manager has been deployed with Jboss\ Wildfly, the application logs (server. log) is stored in a path relative to the installation folder (%Jboss%\standalone\log).


2 Answers

You can remove the console-handler from the servers configuration. By default WildFly logs to the stdout and the server.log. The JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log" is seeing the output from stdout.

To remove the console handler you can execute the following CLI command

/subsystem=logging/root-logger=ROOT:remove-handler(name=CONSOLE)

If you want you could also remove the console-handler itself.

/subsystem=logging/console-handler=CONSOLE:remove
like image 110
James R. Perkins Avatar answered Nov 15 '22 10:11

James R. Perkins


I had similar problem with Windows Service on Wildfly 11.0.0.Final. Wildfly service created two additional log files. Example:
wildfly-stderr.2017-11-22.log
wildfly-stdout.2017-11-22.log
It saved all logs both to stdout file and to server.log.

I couldn't turn of console-handlers due to Spring Boot logging issues on old version. Instead, i edited service.bat and changed this lines:

if "%STDOUT%"=="" set STDOUT=auto
if "%STDERR%"=="" set STDERR=auto

To this:

if "%STDOUT%"=="" set STDOUT=""
if "%STDERR%"=="" set STDERR=""

It looks that after this logging work correctly(remember to uninstall and install service once again). Now it saves logs only to server.log. I tested this for a while and don't see any missing logs.

like image 41
P. Jowko Avatar answered Nov 15 '22 10:11

P. Jowko