Sends exceptions to http://tracemycode.net from JBoss 7.
This is just a simple demo to test posting exceptions to http://tracemycode.net. Use at your own risk!
This involves the following steps:
- Compile source code
- Add new module to JBoss 7
- Configure custom log handler in JBoss 7
mvn clean install
Create folders <jboss-home>/modules/com/jorge/logging/tracemycode/main
.
Create file <jboss-home>/modules/com/jorge/logging/tracemycode/main/module.xml
with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.jorge.logging.tracemycode">
<resources>
<resource-root path="tracemycode-0.0.1-SNAPSHOT.jar"/>
</resources>
<dependencies>
<module name="org.codehaus.jackson.jackson-mapper-asl"/>
<module name="org.apache.httpcomponents"/>
</dependencies>
</module>
Copy file tracemycode-0.0.1-SNAPSHOT.jar
from target
folder into <jboss-home>/modules/com/jorge/logging/tracemycode/main/
.
Open standalone.xml
.
Locate <subsystem xmlns="urn:jboss:domain:logging:1.1">
.
Add, inside that <subsystem>
xml tag:
<custom-handler name="tracemycode" class="com.jorge.logging.tracemycode.TraceMyCodeLogHandler" module="com.jorge.logging.tracemycode">
<level name="ERROR"/>
<formatter>
<pattern-formatter pattern="%d{MMM dd HH:mm:ss} %-5p [%c] (%t) %s%n"/>
</formatter>
<properties>
<property name="clientId" value="ffffffff-ffff-ffff-ffff-ffffffffffff"/>
<property name="version" value="1.0"/>
</properties>
</custom-handler>
Make sure to change the value for properties clientId
and version
accordingly:
clientId
- the identifier of the project from tracemycode
version
- the version of your application. it is debatable why this setting is here.
Add the custom handler to the <root-logger>
.
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
<handler name="tracemycode"/>
</handlers>
</root-logger>