Created
March 6, 2019 09:59
-
-
Save ShubhamS32/7e0b2bf16ec26313feb38feeebc0f282 to your computer and use it in GitHub Desktop.
For Logging Purpose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //log.append(reqTime +" |Exception appErrorCode"+appErrorCode + "| httpErrorCode |"+httpErrorCode); | |
| // logit("PayTM_Exp_Log",true,reqTime,log.toString()); | |
| public static void logit(String filename,boolean newline,String ...X){ | |
| try{ | |
| //String path="C:\\logs\\atom\\"; | |
| String path ="C:\\logs\\paytm"; | |
| StringBuffer sb = new StringBuffer(); | |
| String today = new SimpleDateFormat("MMM-dd-yyyy").format(new java.util.Date()); | |
| BufferedWriter outlog = new BufferedWriter(new FileWriter(path+"\\"+filename+"-"+today+".log", true)); | |
| for(String str:X){ | |
| sb.append(str).append(","); | |
| } | |
| outlog.write(sb.toString()); | |
| outlog.flush(); | |
| if(newline){ | |
| outlog.newLine(); | |
| } | |
| outlog.close(); | |
| }catch(Exception e){ | |
| e.printStackTrace(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment