jsp - Java.util.logger Keeps writing to a new log file -
jsp - Java.util.logger Keeps writing to a new log file -
i'm having issue logger keeps writing new file
logger logger = logger.getlogger("newlogger"); filehandler fh; //create log file string date date = new date(); string yyyymmdd = new simpledateformat("yyyy-mm-dd").format(date); string logfilename = "retrieveproductstracking_" + yyyymmdd; fh = new filehandler("./" + logfilename + ".log"); logger.addhandler(fh); simpleformatter formatter = new simpleformatter(); fh.setformatter(formatter); logger.setuseparenthandlers(false); logger.info(request.getremoteaddr() + ", " + url + ", " + "timestamp" );
this code beingness used in jsp it's called , logger logs url, ip. problem logger writes new file every time, not that...it writes of previous files before too.
not had in mind rotating logs.
see image: http://puu.sh/cnu39/8b814e9f3f.png http://puu.sh/cnvkw/8c0e5dce11.png
you need close file handler fh.close()
1 time you've finished. otherwise, leave files locked. that's why image showing many lock files open!
java jsp logging
Comments
Post a Comment