Dear All,
I am using log4j to log the user details when a submit is clicked in form page. Name, Email address, company etc all details of the user. However after writing to log file, when I open the log file in notepad, the alignment is not good, but if i open the log file in wordpad, the alignment is good.
Sample code:
String htmlContent = "\t" + serverProperties.getString("mail.subject")+" "+ mailFrom + " \n"+
"-----------------------------------------------------------------------------------------" + "\n" +
"\t" + "Type " + "\t" + "|" + "\t" + "Product Info " + "\t" + "-" + "\t" + rq_type_info + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Product Demo " + "\t" + "-" + "\t" + rq_type_demo + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Product Evaluation" + "\t" + "-" + "\t" + rq_type_eval + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Services Info " + "\t" + "-" + "\t" + rq_type_services + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Newsletter " + "\t" + "-" + "\t" + rq_type_news + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Contact Sales " + "\t" + "-" + "\t" + rq_type_sales + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Login Access " + "\t" + "-" + "\t" + rq_type_login + "\n" +
"\t" + "\t \t \t \t" + "|" + "\t" + "Others " + "\t" + "-" + "\t" + rq_type_others + "\n" +
"\t" + "Name " + "\t" + "|" + "\t" + name + "\n" +
"\t" + "Company " + "\t" + "|" + "\t" + company +"\n" +
"\t" + "Job Title " + "\t" + "|" + "\t" + jobTitle + "\n" +
"\t" + "Division " + "\t" + "|" + "\t" + division +"\n" +
"\t" + "Email Id " + "\t" + "|" + "\t" + mailFrom + "\n" +
"\t" + "Work Phone " + "\t" + "|" + "\t" + workPhone + "\n" +
"\t" + "Country " + "\t" + "|" + "\t" + country +"\n" +
"\t" + "Areas of Interest " + "\t" + "|" + "\t" + productGroup +"\n" +
"\t" + "Additional Information" + "\t \t" + "|" + "\t" + additionalInfo +" \n"+
"-----------------------------------------------------------------------------------------";
I have done so, using '\t' tab space but this is not common in notepad and in wordpad.
Please let me share your ideas to do it in
java, so that the alignment looks good in notepad and in wordpad.
REgards,
Prabhu.