-
1. Re: jboss log info twice
rhusar Jul 15, 2013 11:01 AM (in response to gaoyonglu)1 of 1 people found this helpfulSeem like you are bundling log4j, which prints out to console (System.out) which is then caught by AS logger and it wraps the message again and really prints it out.
I would recommend just sticking with what is bundled in the AS, have a provided dependency on JBoss logging jar.
-
2. Re: jboss log info twice
gaoyonglu Jul 16, 2013 1:52 AM (in response to rhusar)I want my ear use log4j and log ConversionPattern use ours。
do you know how AS logger don't wraps the message.
-
3. Re: jboss log info twice
sfcoy Jul 16, 2013 2:26 AM (in response to gaoyonglu)You can still use the log4j API and your own conversion pattern.
Leave the log4j jar (and it's configuration file) out of your deployment (JBossAS will provide an implementation for you) and then change existing JBoss log handlers or add your own as needed. Have a look at the logging subsystem configuration in standalone.xml.
This has the advantage that you can adjust logging configuration while your application is running, which is tricky to do with an embedded properties files based configuration.
-
4. Re: jboss log info twice
gaoyonglu Jul 16, 2013 2:49 AM (in response to sfcoy)my standalone.xml:
subsystem xmlns="urn:jboss:domain:logging:1.2">
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<size-rotating-file-handler name="SIZE_ROTATE_FILE" autoflush="true">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<rotate-size value="100M"/>
<max-backup-index value="8"/>
<append value="true"/>
</size-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="jacorb">
<level name="WARN"/>
</logger>
<logger category="jacorb.config">
<level name="ERROR"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="SIZE_ROTATE_FILE"/>
</handlers>
</root-logger>
</subsystem>
I want use log4j and log4j properties like jboss 5 and jboss logger don't warp my log4j console log
-
5. Re: jboss log info twice
sfcoy Jul 16, 2013 3:01 AM (in response to gaoyonglu)If you really want to stick with your own log4j.properties file then you will need to create a jboss-deployment-structure.xml file as described in https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+AS7 and use it to exclude the logging subsystem from your application.
-
6. Re: jboss log info twice
sfcoy Jul 16, 2013 3:22 AM (in response to sfcoy)I think something like:
{code:xml}<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.logmanager" />
</exclusions>
</deployment>
</jboss-deployment-structure>{code}
could work. I have not tried it though.