0
votes

I am trying to deploy on a WildFly OpenShift Cartridge a legacy webapp that uses commons logging with log4j to display log messages. I've search the whole internet and Stackoverflow, but all the answers I've got so far it doesn't works! Things I've tried so far:

  • Exclude all log api and use logging from WildFly
  • Jboss Logging
  • JDK Logging
  • System out logging
  • bla bla bla logging
  • Use attributes use-deployment-logging-config and add-logging-api-dependencies and start jboss with nohup /var/lib/openshift/540544b2500446d0e6000065/wildfly/bin/standalone.sh -b $OPENSHIFT_WILDFLY_IP -bmanagement=$OPENSHIFT_WILDFLY_IP -Duse-deployment-logging-config=true -Dadd-logging-api-dependencies=false > /dev/null &

Only WildFly is capable to log on console! Nothing else! I don't know if it's something peculiar to OpenShift WildFly cartridge or to WildFly itself. If anyone knows how to log using commons-log (by using private static final Log LOG = LogFactory.getLog(MyClass.class);), please report!

This is my log4j.properties

log4j.rootLogger=INFO, LOG
log4j.appender.LOG=org.apache.log4j.ConsoleAppender
log4j.appender.LOG.layout=org.apache.log4j.PatternLayout
log4j.appender.LOG.layout.ConversionPattern=%d %p %c - %m%n
1
Can you post your log4j config?M..

1 Answers

1
votes

If you have a log4j configuration file in your deployment either remove it or set the attribute use-deployment-logging-config to false. Setting the attribute to false would require you to execute a management operation via CLI or something similar.

The CLI command would look like:

/subsystem=logging:write-attribute(name=use-deployment-logging-config, value=false)

Also make sure you're not including any of the already provided logging dependencies in your deployment.