How to setting Jboss 7 and log4j config outside of the war or ear
fduartej Oct 10, 2012 10:48 AMHi Everybody:
I have been working with WebLogic and Spring for several years, but now I am working with JBOSS 7 and I have some doubs about what is the reason that Jboss not fine when I tried to make some setting about log4j in this case all of properties about log4j are outside of the WAR and EAR because the main reason in my job is that config is only changed for operator, that never should not modified the Component deployed on the server, they only can change the setting that is in other folder, but when I have been setting it on Jboss and all of log is displayed on the server.log but not on the file that I have set.
Please, could you help me, I am sending some of setting that I have done.
I have been trying with that fragment first
-------------------------------------------------------------
<bean id="log4jInitialization"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
<property name="targetMethod" value="initLogging" />
<property name="arguments">
<list>
<value>file:///opt/application-logs/axcess-es-platform-auditevent/config/axcess-es-platform-auditevent.properties</value>
</list>
</property>
Then I have changed it for this
------------------------------------------
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>file:///opt/application-logs/axcess-es-platform-auditevent/config/axcess-es-platform-auditevent.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Some of forums say that it should be added jboss-deployment-structure.xml in both of above setting I have added the setting below on the WEB-INF and META-INF
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
It is my log4j properties (axcess-es-platform-auditevent.properties)
log4j.rootLogger=ALL, logfile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE}|%x|%p|%F:%L|%m%n
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=/opt/application-logs/axcess-es-platform-auditevent/axcess-es-platform-auditevent.log
log4j.appender.logfile.DatePattern='.'yyyy-MM-dd
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss Z}|%x|%p|%F:%L|%m%n
Please, I hope that you can help me.
Thanks in advance
Fred