Reputation: 5654
I'm trying to configure logging for JBoss 7.1.1. I have a well defined log4j.xml which works fine with JBoss 4. This xml file configures logging for various categories of my application. My goal is to use the file instead of configuring in standalone.xml.
Here is what I tried to make it work in JBoss 7.1.1
-Dlog4j.configuration=file:<path to log4j.properties>
. This did not work. It was because standalone.bat was redefining it in the end as follows::RESTART
"%JAVA%" %JAVA_OPTS% ^
"-Dorg.jboss.boot.log.file=%JBOSS_LOG_DIR%\boot.log" ^
"-Dlogging.configuration=file:%JBOSS_CONFIG_DIR%/logging.properties" ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_MODULEPATH%" ^
-jaxpmodule "javax.xml.jaxp-provider" ^
org.jboss.as.standalone ^
-Djboss.home.dir="%JBOSS_HOME%" ^
%*
Questions:
configuration
folder ?Anymore insights are welcome.
Upvotes: 2
Views: 4644
Reputation: 41
i am also facing same problem. My application has log4j.properties files, and not able to create the log files configured in properties. please let me know how you have been resolved the issue.
My application deployed on Jboss AS 7.1.1.
My application log4j.properties file:
############################
# Log configuration file .
############################
log4j.rootLogger=debug
log4j.logger.com.fourthdti=debug, filePerfLog
log4j.appender.filePerfLog=org.apache.log4j.FileAppender
log4j.appender.filePerfLog.File=filePerfLog.log
log4j.appender.filePerfLog.layout=org.apache.log4j.PatternLayout
log4j.appender.filePerfLog.layout.ConversionPattern=%d %-5p - %X{requestId} - {%c{1}} - %m%n
log4j.appender.filePerfLog.MaxFileSize=10MB
log4j.appender.filePerfLog.MaxBackupIndex=5
log4j.appender.filePerfLog.DatePattern=DAY.TOP.1
Upvotes: 0
Reputation: 17760
You can configure logging in your application with a log4.xml, but you cannot configure logging at the server level with a log4j configuration.
For the most part you will be able to translate the log4j configuration into the standalone.xml configuration. The one current caveat would be using log4j appenders. While there are some equivalent handlers not all appenders are covered.
That said if you're feeling froggy and you want to build from source, in the JBoss AS upstream or even the 7.1.3.Final tag you can define log4j appenders as custom handlers.
Upvotes: 2