Hi All, Can any one help me in this,it seems the my tomcat server keeping a refrence of all fileappender
On Sat, Feb 12, 2011 at 11:22 AM, Umesh Awasthi <umeshawas...@gmail.com>wrote: > Hi All, > > I am working on a webapplication and i have a requirment to generate log > files at run time for my impex process.here is the use case > i am validating an XML file and validation error is being handled by custom > Error handler.This error hanlde will be passed to the underlying validator > (Jaxb 2.x validator),so i have to create the log file when the instance of > this error hanlder is being created. > > here is the code to create log file at run time > FileAppender appender; > try { > appender = new FileAppender(layout, sb.toString(), false); > log.addAppender(appender); > log.setAdditivity(false); > log.setLevel(Level.WARN); > } catch (IOException e) { > e.printStackTrace(); > } > > everything is working fine and file is being created correctly as well > being written by the logger to the respective place. > but if i restart my server real problem starts and logger starting > appending the log content not only to its pareent class as well other > classes.here is the details > lets suppose i have 3 log (A,B,C) files already at the location with 3 > lines in each log file and C was the latest file created in the process. > so when i restart my server it some how appending data in to previos all > log files in this fashin > C has still 3 lines > B has now 6 lines > A has now 9 lines > > it seems that the appender i hace created is still open or have refrence > not sure what exactly going on. > any help in this regard will be helpfull. > > > -- > With Regards > Umesh Awasthi > http://www.travellingrants.com/ > > > -- With Regards Umesh Awasthi http://www.travellingrants.com/