log4j is no longer used in JBoss AS 7 there for there is no syslog appender. You would have to find or develop a custom java.util.logging.Handler
if you want something similar.
Once the handler is created it's probably best to make it a module. Let's say the handler was called com.example.logging.SysLogHandler
. In $JBOSS_HOME/modules
create a directory called com/example/logging/main
. In that directory place your library and create an module.xml
file, see another module for an example.
module.xml example:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.example.logging">
<resources>
<resource-root path="sys-log.jar"/>
</resources>
<dependencies>
<!-- Insert any dependencies here like the example below -->
<!-- <module name="org.jboss.logmanager"/> -->
</dependencies>
</module>
You can now edit the standalone.xml
to add a custom handler.
<subsystem xmlns="urn:jboss:domain:logging:1.1">
...
<!-- A syslog handler -->
<custom-handler name="syslog" class="com.example.logging.SysLogHandler" module="com.example.logging">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{MMM dd HH:mm:ss} %-5p [%c] (%t) %s%n"/>
</formatter>
<properties>
<!-- Set any properties that can accessed through setter methods -->
<property name="autoFlush" value="true"/>
</properties>
</custom-handler>
...
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
<handler name="syslog"/>
</handlers>
</root-logger>
</subsystem>