Saturday 15 February 2014

Log Exception Stack Trace with Log4j JDBCAppender -


We are using log4j JDBCAppender in our project but, we are not able to log the exception stack mark in the database. I searched through the net and found me% throwable, but it is not working with JDBCAppender. Can anyone help me do this?

This is my custom adapter code which I have used in the same way as JDBCPaid with small modifications

  public zero-ending (logging event event) {ArrayList buffer = new arrelist () ; Buffer.add (event); FlushBuffer (buffer); } Public Zero FlushBuffer (ArrayList buffer) {for (Iterator i = Buffer. Prohibition (); i.hasNext ();) {try {LoggingEvent logEvent = (LoggingEvent) i.next (); String message resets = getLogStatement (log event); Executed (messageRecievied); } Grip (eclipse e) {this.errorHandler.error ("Failed in Execute SQL", E, 2); }}}   

I do not know why stacktross is not included in it

this is my log4j.xml

  & lt ;; XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt ;! DOCTYPE log4j: Configuration system "log4j.dtd" & gt; & Lt; Log4j: Configuration xmlns: log4j = "http://jakarta.apache.org/log4j/" & gt; & Lt; Epaphroder Class = "Com. Mapper" name = "custom appname" & gt; & Lt; Layout class = "org.apache.log4j.EnhancedPatternLayout" & gt; & Lt; Param value = "% d [% t]% -5p (% F: & amp; lift;% M & amp;;% L) -% m% n" name = "conversion bar" / & gt; & Lt; / Layout & gt; & Lt; / Appender & gt; & Lt; Episode class = "org.apache.log4j.AsyncAppender" name = "asynchapp" & gt; & Lt; Param name = "blocked" value = "wrong" /> & Lt; Appender-Rif Ref = "Custom Appen" / & gt; & Lt; / Appender & gt; & Lt; Root & gt; & Lt; Level value = "INFO" /> & Lt; Epander-reef ref = "asenchappe" /> & Lt; / Root & gt;   

explicitly says this log Does not exception . You have to write a custom appender but I'm pretty sure that such a thing already exists.

No comments:

Post a Comment