0

Customer has a wildfly running with a war that contains this log4j.properties inside:

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{DATE} %5p %c{1}:%L - %m%n

log4j.rootLogger=info, stdout

log4j.logger.org.hibernate=info
log4j.logger.org.springframework=error
log4j.logger.com.ibm.presentation=debug

I want to see the logs from the 'com.ibm.presentation' package, but I can't seem to find them anywhere. The comment in the log4j.properties says 'direct log messages to stdout' but the wildlfy is started as a service and there's no stdout that I am aware of.

Searching in the forum, I tried using jboss-cli adding loggers like described here: Controlling stderr and stdout output in WildFly but no luck at all.

Is there a way to override this log4j.xml in the war and print the log messages of the classes in the package in the normal server.log of the wildfly?

daniel sp
  • 937
  • 1
  • 11
  • 29
  • you should not look for config of wildfly, but of the service wrapper running wildfly. If on windows, that's probably tanuki (look for wrapper.conf). If you find the wrapper, you can probably change its config to handle stdout. – Joeri Hendrickx Jan 23 '18 at 13:42
  • It is linux. Ubuntu. – daniel sp Jan 23 '18 at 14:15
  • If its started as a service - you should still be able to edit the service script and not have it write stdout and stderr to /dev/null (the usual) and instead have it write to a log file of your choice. In the WAR, you can also edit log4j.properties file, a WAR is just a zip file, unizp it (or edit the file in place if you can), modify the file, re-zip and re-deploy it – JGlass Jan 23 '18 at 14:44
  • Hi, JGlass, tks for your comments. Unfortunately I cannot restart the system. My idea was to redirect the output of the stdout with log4j by adding some logging on the fly using the jboss-cli.sh but I see that is not possible. Maybe it's more like a linux question... Is is possible to redirect the stdout of an application that sends it to /dev/null without stopping it? – daniel sp Jan 24 '18 at 07:33

0 Answers0