-
1. Re: Adding log4j categories and appenders to jboss logging subsystem for jboss 7.x
jamezp Dec 9, 2013 7:25 PM (in response to neeraj587)If you want to use log4j as a logging facade all you need to do is ensure you don't have a log4j configuration file in your deployment and don't include a log4j library in your deployment. As long as you do those two things it should work without a problem and the configuration in the logging subsystem will be used.
--
James R. Perkins
-
2. Re: Adding log4j categories and appenders to jboss logging subsystem for jboss 7.x
neeraj587 Dec 10, 2013 4:44 AM (in response to jamezp)Hi James,
Thanks for the reply. I will just elaborate the question more. I want to add the log4j specific properties to the logging subsystem in the jboss server standalone.xml file.
Some example properties are :
# Set Category specific property
log4j.category.kodo.MetaData=INFO
# Set appender specific options
log4j.appender.MaxFileSize=10mbFrom what I understand from your solution on this question Re: jboss-eap-6.1 + log4j configuration ; that it is not possible.
Like adding something like :
<appender name="App1Log" class="org.apache.log4j.FileAppender">
<errorHandler
class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Append" value="false"/>
<param name="File"
value="${jboss.server.home.dir}/log/app1.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>Is this configuration valid for Jboss EAP 6.1 ?
Thanks
-
3. Re: Re: Adding log4j categories and appenders to jboss logging subsystem for jboss 7.x
jamezp Dec 10, 2013 12:18 PM (in response to neeraj587)Ah gotcha, no that won't work. However you can use the logging subsystem to do the same thing you're doing. The configuration would look like;
<subsystem xmlns="urn:jboss:domain:logging:1.2"> ... <!-- defines a rotating file handler --> <size-rotating-file-handler name="App1Log" autoflush="true"> <file relative-to="jboss.server.log.dir" path="app1.log"/> <formatter> <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n"/> </formatter> <rotate-size value="10mb"/> <max-backup-index value="5"/> <append value="false"/> </size-rotating-file-handler> <!-- defines a logger --> <logger category="kodo.MetaData"> <level name="INFO"/> </logger> ... </subsystem>
I would however suggest having a look at adding loggers and handlers using CLI or the web console. CLI has tab complete which makes it very useful IMO.
With EAP 6 you can use log4j appenders as custom-handler's. I would however suggest if you're just using file handlers or a console handler use the provided handlers. They will be more efficient.
--
James R. Perkins
-
4. Re: Adding log4j categories and appenders to jboss logging subsystem for jboss 7.x
neeraj587 Dec 10, 2013 3:47 PM (in response to jamezp)Thanks James...got it..