I have ear
of my project and it is successfully working. In the Jboss
log all the messages are printed.(INFO
, DEBUG
, WARN
, ERROR
. etc...)
Now I am trying to build a web app to show all ERROR
messages real time.(the moment ERROR
occurred). Currently I am planning to call a web service. Then I can show the messages in real time through the web app.
I have tried with logback(http://logback.qos.ch/) following and it is working for standalone only.
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="fileAppender" class="com.test.MyAppender">
<append>true</append>
<encoder>
<pattern>%d [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<root level="error">
<appender-ref ref="fileAppender" />
</root>
</configuration>
MyAppender
class.
public class MyAppender extends ch.qos.logback.core.AppenderBase {
private Logger logger = LoggerFactory.getLogger(MyAppender.class);
public static List<Object> list = new ArrayList<>();
private String endpointUrl;
@Override
public void append(Object eventObject) {
list.add(eventObject);
sendRequestToRESTAPI(eventObject);// calling the web service
}
}
This standalone application works fine. when ever the error
occurred append()
method will call.
But this approach is not working with Jboss
since append()
is not triggered. I am not sure the reason since I am new to Jboss
. But I think that will be issue with Jboss
log Adapter. How can i change this to work with Jboss
.?